This is a migrated thread and some comments may be shown as answers.

Updating groups and Aggregates

2 Answers 196 Views
GridView
This is a migrated thread and some comments may be shown as answers.
JP
Top achievements
Rank 1
JP asked on 17 Apr 2009, 10:13 PM
Hello,

I would like to know what events make the grid decide to update the groups and recalculate the aggregate values?  Is there any way to force the grid to recalculate the groups and aggregate values?

In my app I have a grid that is bound to objects that implement INotifyPropertyChanged.  If I have a group setup in the grid and I use the grid to edit the value that the grid is being grouped on, the row moves to the appropriate group when the values changes, which is good.  However, I also have a form outside the grid that lets you edit the currently selected item.  When I change a value in the form that the grid is grouping on, the row that was edited doesn't move to a new group.  Any idea why this is happening?

What I need to be able to do is to use a form outside the grid to edit the grid's selected item and have the grid move the row to a new group if the value that's being group by has changed.

Some additional, potentially useful info:
My objects store Key/Value pairs that are accessible through an indexed property (i.e. myObject["FieldName"]
I setup by column bindings like this: DataMemberBinding = new Binding("[FieldName]")
Whenever a property on my object changes, I raise the PropertyChangedEvent with string.Empty for the property name

Thanks,

Joel

2 Answers, 1 is accepted

Sort by
0
Accepted
Hristo Deshev
Telerik team
answered on 21 Apr 2009, 09:46 AM
Hi Joel,

RadGridView listens for collection change events: INotifyCollectionChanged or IBindingList.ListChanged. This example seems to do something similar to what you describe. It has an edit form outside the grid that modifies an object. The grid is bound to a DataView (an IBindingList implementor), and the display is updated as data changes.

I guess the easiest way to achieve a similar functionality is to pass a collection that is IBindingList because of its ListChanged action type of ItemChanged. You can inherit from BindingList<T> and get the functionality for free.

All the best,
Hristo Deshev
the Telerik team

Instantly find answers to your questions on the new Telerik Support Portal.
Check out the tips for optimizing your support resource searches.
0
JP
Top achievements
Rank 1
answered on 21 Apr 2009, 06:01 PM
Hi Hristo,

Thanks for the reply.  I switched over to using BindingList<T> and now it works fine.  I didn't know that the grid would only update the groups on ListChanged or CollectionChanged so I was just using ObservableCollection<T>.

Thanks again,

Joel
Tags
GridView
Asked by
JP
Top achievements
Rank 1
Answers by
Hristo Deshev
Telerik team
JP
Top achievements
Rank 1
Share this question
or