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

Sorting non-databound grid row selection

I am using the sorting from the samples to sort my non-database grid control. It is working fine except I would like to keep the same row selected. So if the second row moves to the first after the sort I would like the first row to be selected. Is there anyway to do this without searching thru all the rows manually to determine a match.

1 Reply

AD Administrator Syncfusion Team August 20, 2003 07:24 PM UTC

Before sorting, you could add a 'hidden' column, and in this column put a 0 or 1 to indicate that the row is selected. Then when you sort this indicator will move with the sort. So, after the sort you could loop thorugh the column to see what rows should be selected in the sorted grid. Better yet, instead of adding the extra column, you could put the 0 or 1 in style.Tag of the row header's style object. I don't know whether this would be more efficient of just searching through rows after the sort.

Live Chat Icon For mobile
Up arrow icon