Closed jeffreycahyono closed 8 years ago
An easy way to do this is by using Backgrid.getSelectedModels().length
That will give you the length of the array returned by getSelectedModels()
which should be equal to the number of selected rows.
Yes I know, but the implementatin of getSelectedModel iterate selectAllHeaderCell.selectedModels
which is not efficient if called repeteadly. It would be more efficient if the getCountSelecetedModels()
can directly retrieve selectAllHeaderCell.selectedModels.length
instead
There isn't a way to know for sure whether a model had been selected without checking to see if it's in a collection, so just return the length of selectedModels
won't work.
It would be useful for this extension to have
Backgrid.getCountSelectedModels()
to retieve the number of selected models,The use case is like the Gmail UI button, where certain toolbar button is displayed only when there are some row selected. The toolbar listens to
backgrid:select
event and retrieveBackgrid.getCountSelectedModels()
. If the result is bigger than zero the groups of toolbar shown