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. (Last updated on: June 24, 2019).
Unfortunately, activation email could not send to your email. Please try again.
Syncfusion Feedback

Grouping grid checkboxes - Cancelling ''sort''

Thread ID:





18976 Sep 15,2004 12:22 AM UTC Sep 20,2004 02:25 AM UTC WinForms 4
Tags: Grouping
David Llewellyn
Asked On September 15, 2004 12:22 AM UTC

Hello, I am displaying 3 checkboxes for each record in a grouped grid and have cancelled the sort column functionality of the grid (i.e. grid.TableOptions.AllowSortColumns = false;). But after I click on a checkbox, the records are re-ordered and shift position. This can be very annoying, especially if there is a lot of records. Is there any way I can switch this off?? Thanks.

Administrator [Syncfusion]
Replied On September 15, 2004 11:00 AM UTC

David, Did you add any fields to the SortColumns collection? Or is the underlying datasource sorted by these fields? The reason I am asking is because if you have SortColumns defined the grid needs to honor that sort order when values change. But if you make sure that none of these fields affect the sort order that should be no problem and no record will be rearranged. If the underlying datasource the grid reacts to ListChanged event from that datasource when a record is changed. It tells the grid to remove the record from a specific position and insert it in another position. The only way to prevent this from happening would be to tell the grid to use its own sort order by specifying SortedColumns. Then that sort order will have precedence over the sort order of the underlying datasource. And if your checkbox columns don''t affect the grids sort order the record should stay at the old position. Stefan

David Llewellyn
Replied On September 16, 2004 03:56 AM UTC

Hello Stefan, I have added fields to the SortColumns, but these are not any of the checkbox fields. The only time I sort the underlying datasource is when I retrieve the data from my datatable. But that is done by SQL. The records shift when they are clicked on, but they dont seem to sort themselves in order of the checkboxes ''true'' and ''false'' values. Any idea''s why these are shifting around?? Thanks. David

Administrator [Syncfusion]
Replied On September 16, 2004 03:12 PM UTC

David, I assume that the underlying DataTable.DefaultView raises ListChanged events becuase the rows in that table are shifted around. You could find out about this by listening to DataTable.DefaultView.ListChanged event and see what events are raised. Is there any field in your table that you could sort on? That field could take precedence ahead of the underlying datasource. If you keep on having problems just prepare a small sample and then I can debug into it. Thanks, Stefan

David Llewellyn
Replied On September 20, 2004 02:25 AM UTC

Hello Stefan, Thank you for your help. I found out that the ListChanged event is being raised (like you said) and the message that is being sent, when the checkbox is clicked, is "ItemChanged". I can simply ignore these events by using the following line of code :- if (e.ListChangedType.ToString() == "ItemChanged") return; Now the records do not shift around. Thanks again, David.


This post will be permanently deleted. Are you sure you want to continue?

Sorry, An error occured while processing your request. Please try again later.

Please sign in to access our forum

This page will automatically be redirected to the sign-in page in 10 seconds.

Warning Icon You are using an outdated version of Internet Explorer that may not display all features of this and other websites. Upgrade to Internet Explorer 8 or newer for a better experience.Close Icon

Live Chat Icon For mobile
Live Chat Icon