Skip to content

Conversation

Robinson7D
Copy link
Contributor

This method would help in implementations that show the number of selected items in a different way that the bottom info-bar.

Previously, the only ways to get the number of items are selected are less than ideal:

  1. Call getSelectedGridRows().length on the API - this is slow because getSelectedGridRows() calls a filter on the entire dataset - which would be a performance drag if called every $digest cycle. One can avoid calling it on every cycle by binding a function that calls it to both rowSelectionChanged, and rowSelectionChangedBatch, but the resulting code is way less clear than simply api.selection. getSelectedCount()

Or 2) Render and hide the info bar, and try to parse its number. This should be avoided, as it's a hacky solution.

Since the number is already being held (and used internally), providing the number is trivial; so it seems like a good candidate for the API.

@Robinson7D Robinson7D force-pushed the feat/selection-count branch from 2a12573 to 99beada Compare January 4, 2016 19:12
swalters added a commit that referenced this pull request Jan 6, 2016
Add selection PublicApi method to expose selected count
@swalters swalters merged commit 591089a into angular-ui:master Jan 6, 2016
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants