I use standart Ext.grid.Panel in extJs. I need to select up to 500 rows in grid, and I want to know how many rows I have selected. I do it in such way:
multiSelect: true,
listeners:
{
'select':
function( combo, record)
{
mainNS.app.pagingTB.items.get('selected-sited').update(' count of selected rows: ' +
mainNS.app.mainGrid.getSelectionModel().getCount())
}
},
But it works too slow, how can I optimize this operation?
The select event will fire for every record during a multiple selection. So if n rows are being selected at once, that means you're updating the content and, most importantly, triggering a layout n times.
You have 2 options:
selectionchange
event, which will fire only once for a batch of selections.buffer: 1
as an option to the select event, so it will buffer the event from firing until the last selection has occurred.No. 1 is the preferred solution.