Is there a way for force InitializeRow() to be raised again for the visible rows and clear the cached state of rows that were once in view?
Imagine I have a color picker above the grid where the user can pick a color for rows that meet certain criteria. When the user changes that color, I don't want to call Rows.Refresh(RefreshRow.FireInitializeRow) as I observed this fires the event for all rows, not just the visible ones. I thought perhaps one option would be to iterate over just the visible rows explicitly refreshing them, but this doesn't handle the case where a row was visible and now scrolled out of the visible area - the grid won't raise the event again when the row is scrolled into view.
The UltraGridRow object also has a Refresh() method. Calling Refresh(RefreshRow.FireInitializeRow) on an individual row should cause only that row to be re-initialized, in the same way that calling Rows.Refresh(RefreshRow.FireInitializeRow) on the grid does the same to all rows in the grid.
Hi Vince, Thank you for the reply. Unfortunately, re-initting a single row doen't work for our scenario - as re-initting all rows (11,000) is undesired. It would be better if we would re-init only the rows that have been initted - or optimally, just reset the internal "initted" cache state in the ultragrid so that it will re-init the ones it needs to as needed, just as it does immediately after binding. Is this possible?
Thank you,
Mark
Mark,
I'm not really sure there's a good way of doing this. The grid doesn't really keep an internal cache of what rows have been initialized through the IntializeRow method, since there are a variety of triggers for this event to keep firing (i.e. changing the value of a cell). The grid will fire the first InitializeRow event when the UltraGridRow object needs to be created, so the closest to the concept of this cache is the array of rows that the grid holds onto. The only real way to clear this cache would be to re-bind the grid, I believe, since this will then mimic the original behavior that you're experiencing; the grid should be reusing UIElements as possible, so you are not losing everything, but this obviously is not an ideal situation.
-Matt