I have a binding source bound to an ultragrid. When I use binding source filter to filter out rows, it is working fine. However, once I completely clear the filter, the rows order does not go back to the original order. Whatever filtered by filter before clearing it remains on top and other rows appear after these rows. I want it to go back to original row order once filter is cleared. How can I achieve that?
Thank you for posting. I discussed the matter with the developer and find there is no way to achieve it. The grid deals with IBindingList and it doesn't have any filtering notifications. So all the grid knows about is the rows you give it. So when you clear the filter, it must be notifying the grid that something has changed and the grid is maintaining the existing rows and just showing the new ones. I mean, you could get it to show in the original order by setting the grid's DataSource to null and then back. But then you would lose all of the other state information. That's the only way.
Please let me know if you have any question.
There is one other approach you might take, but I wouldn't recommend it. There's a Move method on the grid's Rows collection. So you could manually re-order the rows in code to match the data source one at a time by moving each row individually to the right spot. If you only have a few rows, it might be worthwhile. But if you have thousands of rows, it would probably be easier to just reset the DataSource.