Hello,
I have a scenario in which I need to programatically set selected rows in the RadGridView. I am using the RadGridView.SelectedItems property to achieve this. This collection is of type ObservableCollection, and when attempting to invoke SelectedItems.Add() many items in a loop, the ObservableCollection's OnCollectionChanged event fires for each Add(), which becomes unacceptably slow. I understand that is the intended behavior of the ObservableCollection. The SelectedItems property is also readonly, so I can not do a reassignment to work around it.
Can you recommend a solution for this? If the SelectedItems could be of a type that inherits from the ObservableCollection and that implements an AddRange() method, that would solve the problem. Any suggestion is appreciated. Thanks!
10 Answers, 1 is accepted
Unfortunately, "bulk add" is not supported at the moment but we are currently working on improving the performance of our selection mechanism.
May I ask you for some more information about your scenario so that I could try to provide you with some kind of workaround? How many items are being added to SelectedItems? Are you performing any action on OnCollectionChanged?
Best wishes,
Milan
the Telerik team
Milan,
Potentially, thousands of items are added to the SelectedItems collection. I am not performing any actions on OnCollectionChanged.
thanks,
Ed
Unfortunately there is no way to optimize the performance for this scenario at the moment. We are currently working on improving the overall selection performance which will resolve this problem. It is still unclear when those optimization will be available but we hope to introduce at least some of them with SP1 which will be release in mid January.
All the best,Milan
the Telerik team
Our application interfaces with a lot of other products and the selection of data needs to be passed between these products and the grid. As a result we need a fast method for updating the selected rows. And, of course, we need this ASAP.
As mentioned previously, we do our best to provide improvements on the functionality and performance for the selection. However, our intentions are to implement those enhancements only after they are fully tested and well-thought. Meanwhile, in case it is appropriate for you, you may give us a bit more details on the particular settings and scenarios you handle, so that we could make further tests targeting your cases.
Again, thank you for the cooperation and patience.
Maya
the Telerik team
I have got the same issue. I need to add thousand thousands of rows into 'RadGridView.SelectedItems' . Since there isn't any bulk add for that I had to add them one by one in a loop , which cause the UI page freezing for a while.
I was wondering if this issue has been fixed? The version I'm using right now is '2010.3.1314.1040'
Many thanks,
Kind Regards,
Naseem
Please use our latest official version (Q1 2012 SP1) for faster selection.
Regards,Vlad
the Telerik team
Explore the entire Telerik portfolio by downloading the Ultimate Collection trial package. Get it now >>
I have version Q2 2012 and I don't see method or property for bulk add.
Can you give me the property, method name, or code example that supports setting the SelectedItems to an ObservableCollection without looping through the collection?
Thanks!
You can use the Select method of the GridViewDataControl.
Hope this helps!
Nik
the Telerik team
Explore the entire Telerik portfolio by downloading the Ultimate Collection trial package. Get it now >>