We use cookies to give you the best experience on our website. If you continue to browse, then you agree to our privacy policy and cookie policy. Image for the cookie policy date
close icon

Sorting a column having a dropdown list in a databound grid by display member

I am using version 2.1.0.9 of syncfusion. I have a databound grid with one of the column having a dropdown. By default the column gets sorted by value member. I need to sort it by display member. To acheive the same, I have implemented IBindingList and overriden the Applysort & used custom sorting. Now the column gets sorted by display member as expected. But Whenever the underlying view gets refilled or changed the container holding the sorted index becomes invalid (for eg. Mine is a tabsheet application & when I go to some other page & come back the view gets refreshed & I get Indexoutof bound of exception. I do not have any way to track when the underlying view of the grid will get changed or refreshed & I have to resort the container which holds the sorted indices. If needed I will send the class I have written. I thank you in advance for the reply. Also similar query I have for the grouping grid.

3 Replies

AD Administrator Syncfusion Team November 17, 2005 05:45 PM UTC

In the case of a DataView, when the datasource is sorted, a ListChanged.Reset event is raised. Are you doing this in your implementation? If you can upload a sample project showing the problem, we can try to debug it here.


SB Sachin Bamel November 17, 2005 07:35 PM UTC

I am calling this.OnListChanged(new ListChangedEventArgs(ListChangedType.Reset, -1)); Even the sorting is working as expected. The problem occurs when mModelTable.BeginLoadData(); mModelTable.Clear(); mDataAdapter.Fill( mModelTable ); After this the view gets changed & the container which holds the index of the data in the column becomes invalid so I need to resort this array again. Even I somehow took care of these situation. There are couple of other situations where indirectly view gets changed & since I am not able to track them, the container''s indexes gets invalid. I am just attaching the 2 files Referencedataproxy.cs where the IBindingList is implemented and Rowcomparer.cs where I have implemented IComparer interface. I hope you will get some clue out of it.

files1.zip


AD Administrator Syncfusion Team November 17, 2005 08:22 PM UTC

Without a running sample, and being able to debug the behavior it is difficult to be of much help. Just something to try. Before reloading your data, somehow clear the sort so mSortOrder = null; and mView.Sort = "".

Loader.
Live Chat Icon For mobile
Up arrow icon