PDA

View Full Version : Sorting Buffered Grid Clears SelectionModel



jsheely
7 Aug 2014, 5:55 AM
Using ExtJS 4.2.2 I have a grid with a buffered store and the selModel: {pruneRemoved:false }

If I select a row and then re-load the grid the selectionModel persists as it should. However if I sort by one of the columns then the selectionModel is cleared.

Short of storing the selectionModel somewhere else and then reapplying the selections after the sort. Is there a flag I'm missing to make this work? Or is there a simple override that makes sense to retain the selected rows after a sort operation?

Thank you

jsheely
7 Aug 2014, 6:25 AM
I tracked down a possible cause of the selection model getting cleared.

/src/selection/Model.js



onStoreClear: function() {
if (this.selected.getCount() > 0) {
//this.clearSelections(); //Commenting this out fixes the problem.
this.maybeFireSelectionChange(true);
}
},



I haven't determined if this is actually the best fix yet.