Hi,
I have certain columns in my grid where I customize the GroupByRow description property in the OnIntializeGroupByRow handler. Lets say the default format of that description is "ColumnName : ColumnValue (# items)". I am customizing the ColumnValue part of the description string and leaving the rest alone as it is.
When I am grouped by this column and I delete rows from this group, the # items count does not update in real time. When I group by other columns where I am not customizing the GroupByRow description, the # items count will update right away. I see that OnInitializeGroupByRow does not fire when rows are deleted. How can I refresh my custom GroupByRow descriptions when data changes in the grid?
Thanks,
~Corey
Hi Corey,
That seems like it might be a bug. The event should fire any time the description might change. But even so, it's probably not something we can change, since changing event firing is a very dangerous and potentially breaking change.
Are you deleting the row through the grid or directly on the data source?
If it's through the grid, then you should be able to work around this pretty easily:
private void ultraGrid1_AfterRowsDeleted(object sender, EventArgs e) { UltraGrid grid = (UltraGrid)sender; grid.Rows.Refresh(RefreshRow.FireInitializeRow, true); }
If you are deleting the rows through the data source, then you can basically do the same thing, but you will have to find a way to trap when the rows are deleted. Since you are doing it in code, it should not be too difficult, but you might have to use a BeginInvoke to avoid any timing issue.
Mike,
I am deleting/adding rows through the data source, and your suggestion does seem to work. However, in the OnInitializeGroupByRow handler, the count of items in the description string is still not correct, but the row count for the group is correct. So basically I can no longer trust the count in the description string and will have to customize the count as well by using the row count.
Thanks for the help,