Display sum of values of a column in Group Header row
Hi,
We require feature of Real Time Grouping, similar to what you have in your sample application. But instead of displaying the child rows count in each group header, we want to display the sum of a particular column(s) in the group row. But the OnPaintGroupRow event row is executing in case of addition/deletion of rows from the group. That means RowCount feature will work fine but not the SUM feature, as it might be possible that we just have update of the content (no addition/deletion). I tried other events also but no one is updating the group header text. Kindly help.
Regards,
Prakash
-
Hi,
This event is called each time when the grid repaints a group row. For example you can hide a part of the grid with other window and then put that window on the taskbar: if some part of a group row was hidden, then you’ll get OnPaintGroupRow notification.
It is possible to ask the grid to repaint a particular row or cell. You can do it just calling Row.Invalidate()/Cell.Invalidate(). The grid does it implicitly when a row is added or removed to/from a group.
What is about your application, when a value is updated, you can take a row’s parent and call the invalidate method. If you use INotifyPrpertyChanged Interface, the best way is to subscribe for Grid.RowUpdated event and invalidate there the group:
grid.RowUpdated += delegate(object sender, GridRowUpdateEventArgs e)
{
Row parent = e.Row.Parent;
if(parent != null && parent.IsGroup)
{
parent.Invalidate();
}
};Best regards,
Dapfor0
Please sign in to leave a comment.
Comments
1 comment