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

Problem with hidden row when doing sorting

I have a grid control in my project, and hide some rows, when I sort the column, the hidden rows reappeared. How can I prevent the hidden rows from appearing again? Is this a bug? I call this.Data.SortByColumn(col,(ListSortDirection)this[0, col].Tag); in the derived grid control.

4 Replies

AD Administrator Syncfusion Team June 30, 2004 12:24 PM

You will have to handle this yourself. The grid does not try to manage this for you. A couple of ways you could do this. One is to move all teh hidden rows to the top. Then you can use the overload of SortByCol that accepts 3 arguments, the last one being extra header argument that you can set to avoid these rows being affected by the sort. Another technique might be to loop through the rows before the sort an dset a flag in grid[row,1].Tag that marks whether teh row is hidden. Then after the sort, you can loop through again and test for this flag to make sure teh right rows are visible or not.


AD Administrator Syncfusion Team June 30, 2004 12:31 PM

I already going down the second method that you suggested. I see flickering when I am resetting the row state. Is there a method in the grid to suspend the redraw before sorting and setting the visible state, and than resume the redraw?


AD Administrator Syncfusion Team June 30, 2004 12:45 PM

Before sorting, call grid.BeginUpdate() and then later call grid.EndUpdate(). If the grid does not redraw itself, try calling grid.Refresh().


AD Administrator Syncfusion Team June 30, 2004 12:48 PM

thank you very much.

Loader.
Live Chat Icon For mobile
Up arrow icon