Can anyone tell me how to force the ultragrid to display row 0 after I apply my grid filter?
I have tried these with no success--
ultragrid1.DisplayLayout.ActiveRow = ultragrid1.Rows(0)
ultragrid1.ActiveRow = ultragrid1.Rows(0)
ultragrid1.Rows(0).Activate()
ultragrid1.ActiveRow = ultragrid1.GetRow(Infragistics.Win.UltraWinGrid.ChildRow.First)
Matt,
I tried your code and it worked.
much appreciated!
-duane
Mike,
I do not use the grid column filters. My filters are built in my code and they are working. But the BeforeRowFilterChanged event does not fire with filters built in code.
I am assuming that I can not use my filters built in code and use the BeforeRowFilterChanged event.
Is that correct?
Filters are applied to the grid asynchronously by default. So if you use the AfterRowFilterChanged event or try to do this immediately after applying a filter in code, it probably won't work. In order for this to work, you would have to force the filtering to be performed synchronously. You can do this by handling the BeforeRowFilterChanged event and setting the ProcessMode to Synchronous. Then you could use AfterRowFilterChanged and then either Nick or Matt's suggestions will probably work.
Nick,
thanks for the tip. i thought that would work, but it did not.
I think it must have something to do with the filters being applied.
After I apply the filters I do this - ultragrid1.PerformAction(UltraGridAction.FirstRowInBand).
But the grid always ends up at the bottom of the grid.
I am still looking for a solution.
If you're trying to activate the first row in the set of rows that's been filtered, you need to get a collection of the filtered-in rows; the Rows collection itself on the grid isn't altered when you perform filtering. You could do something like:
Dim rows As Infragistics.Win.UltraWinGrid.UltraGridRow() = Me.UltraGrid1.Rows.GetFilteredInNonGroupByRows() If Not rows Is Nothing And rows.Length > 0 Then rows(0).Activate() End If
-Matt