What's the best way to maintain Grid Selection after the user sorts a column? Right now when the user changes the sort by clicking a column header the selection disappears.
2 Answers, 1 is accepted
0
Iliana Dyankova
Telerik team
answered on 21 Apr 2012, 03:27 PM
Hi Nathan,
Such functionality is not supported out of the box, but you could achieve it using custom logic. I would suggest to maintain the selected rows uid and in onDataBound event to set the CSS class k-state-selected to these rows. For convenience I created a jsFiddle example, which illustrates this approach in action.
Please keep in mind that in case you use remote data and server paging, when you navigate from page to page, the row uid changes and as a result the selection will not be saved.
Greetings,
Iliana Nikolova
the Telerik team
Join us on our journey to create the world's most complete HTML 5 UI Framework - download Kendo UI now!
I needed this too. The select drops on sort, filter, and probably any other grid event that requires a re-read. So the below seems to handle all cases. Please Kendo team, put your magic touch on this and add this to the core with a property called "selectRebind: true" or something like that. Thanks!
onDataBinding: function(e) {
//GET CURRENTLY SELECTED DATA ITEMS FOR SELECTING LATER