Hi,
I am facing an issue with the selected items order . When we select multiple rows in the grid using shift select the order of the selected values is not the same the order they are present in the grid. For example as we select row 1 and shift select row 10, we are expecting selection order as from row 1 to row 10, but what we are getting as row1, row 10, row 2-9. Please suggest me the possible changes to maintain the order.
Thanks,
I am facing an issue with the selected items order . When we select multiple rows in the grid using shift select the order of the selected values is not the same the order they are present in the grid. For example as we select row 1 and shift select row 10, we are expecting selection order as from row 1 to row 10, but what we are getting as row1, row 10, row 2-9. Please suggest me the possible changes to maintain the order.
Thanks,
4 Answers, 1 is accepted
0
Hello Rahul,
Generally, the SelectedItems collection of RadGrid returns the items in order of their selection time. I have prepared a sample RadGrid web site to demonstrate how you can sort their indices. Please run the attached application and let me know if it helps you.
Regards,
Eyup
Telerik
Generally, the SelectedItems collection of RadGrid returns the items in order of their selection time. I have prepared a sample RadGrid web site to demonstrate how you can sort their indices. Please run the attached application and let me know if it helps you.
Regards,
Eyup
Telerik
If you want to get updates on new releases, tips and tricks and sneak peeks at our product labs directly from the developers working on the RadControls for ASP.NET AJAX, subscribe to the blog feed now.
0
![](/forums/images/avatarimages/default.gif)
Ankush
Top achievements
Rank 1
answered on 04 Nov 2014, 08:50 PM
MasterTable.get_selectedItems() is returning selected items in order in which they were selected but I want to ignore the selection order and get items selected in order in which they appear in the radgrid.
Please help!
Thanks,
Ankush
Please help!
Thanks,
Ankush
0
Hello Ankush,
I will forward your requirement to our dev team and let you know about the result when ready.
Regards,
Eyup
Telerik
I will forward your requirement to our dev team and let you know about the result when ready.
Regards,
Eyup
Telerik
Check out the Telerik Platform - the only platform that combines a rich set of UI tools with powerful cloud services to develop web, hybrid and native mobile apps.
0
Hello Ankush,
Thank you again for your patience.
You can achieve the requested functionality using the following approach:
Hope this helps. Please give it a try and let me know if it works for you.
Regards,
Eyup
Telerik
Thank you again for your patience.
You can achieve the requested functionality using the following approach:
function
buttonClick() {
var
selectedItems = $find(
'<%= RadGrid1.ClientID %>'
).get_selectedItems();
selectedItems.sort(SortByIndex);
}
function
SortByIndex(a, b) {
var
aIndex = a.get_itemIndex();
var
bIndex = b.get_itemIndex();
return
((aIndex < bIndex) ? -1 : ((aIndex > bIndex) ? 1 : 0));
}
Hope this helps. Please give it a try and let me know if it works for you.
Regards,
Eyup
Telerik
Check out the Telerik Platform - the only platform that combines a rich set of UI tools with powerful cloud services to develop web, hybrid and native mobile apps.