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

Maintain row selection after sort


Let's say I have a grid with 5 rows and it starts out sorted by column 1. Let's also say that the user has selected row 3 and then chooses to sort the grid by column 2. Is there any convenient way to know the row index of the data that was previously in row 3?

Here's an example:

Art Torres 33202
Bob Salas 1202
Charlie Johnson 2021
Dina Harding 7500
Ed Haslett 5202

If "Charlie Johnson" is selected and then the grid is sorted by column 2, the row containing "Charlie" will now be row 2. Is there an easy way to determine this?

The reason for asking is that I want the full-row-select to be maintained after a sort operation.

Thanks...

Sean



1 Reply

AD Administrator Syncfusion Team May 30, 2008 08:15 AM UTC

You did not mention which grid you were using. Selected records should be maintained automatically through a sort if you are using a GridGroupingControl. If you are using a GridDataBoundGrid, then that grid relies on the underlying IBindingList.Sort to manage the sorting and this does not include preserving selected records.

Here is a forum post that asks about preserving selections when sorting a GridDataBoundGrid.
http://www.syncfusion.com/support/forums/message.aspx?MessageID=74058



Loader.
Live Chat Icon For mobile
Up arrow icon