Currently I'm using the InitializeRow to set the color of the Row. This works fine until the datasource connected with the UltraGrid is changed. When that happens, no InitializeRow is executed. The values in the row change but I don't seem to find a way to detect this. If the values change, then the colors might also be changed.
I've tried AfterRowUpdate but that only gets fired if data goes from the UltraGrid to the Datasource... In my case a Refresh of the data might be done which recycles the existing rows not firing an InitializeRow event.
The colors vary according to a value of a column, so I do need to do it this way.
Thx, Lieven Cardoen
Hi,
I'm having a hard time following you. The InitializeRow event fires whenever a new row is added to the grid or a value within a row changes. If you have 50 rows in your data source and you add 50 more, then the position of those rows does not matter. The data source should be sending Add notifications and the grid will respond to those notifications by firing InitializeRow for the new rows.
I'm not familiar with the Pro Binding Source by OpenEdge. Perhaps it's re-using the same row instances for the 50 new rows or something like that.
If that's the case, then you could work around the issue by calling grid.Rows.Refresh(InitializeRow) to force InitializeRow to fire again for all rows in the grid.
Problem seems that first I fetch for instance 50 records. InitializeRow is fired for these 50 records.
Then 50 new records are fetched, but records that come before the first 50 records. So in the bindingsource they come before the first 50.
Now it seems that the 50 first rows in the UltraGrid are used for the 50 new records, and 50 new rows are created for the 50 old records. And InitializeRow is fired again for the 50 old records, being 50 new rows.
Problem here is that background color of rows that was intended for the 50 first records is now applied to the 50 new records... Crazy...
The InitializeRow isn't fired for the 50 first records because according to the BindingSource nothing changed...
I'm kind off lost here. By the way, the binding source is a pro binding source from OpenEdge... Don't ask.
Hi Lieven ,
What kind of DataSource are you using? If your data source supports IBindingList and it sends a notification when cell values are modified, then the grid will fire InitializeRow. If not, then the grid will not know anything changes and there is no way the grid can fire an event.
Since you are saying that the grid display is updating correctly, that seems to indicate that the grid is getting a notification. So InitializeRow should be firing. Are you sure it's not?
You can manually force InitializeRow to fire by calling grid.Rows.Refresh(FireInitializeRow). But you shouldn't have to do that.