From RadGridView's point of view, all that matters is the INotifyCollectionChanged events that it receives from its ItemsSource. You mentioned that your results come to the client in batches from time to time and you want those result to appear in the grid as soon as they arrive. The only way I can think of about doing this would be to bind the grid to something that implements INotifyCollectionChanged and when results arrive to the client raise the CollectionChanged event with the appropriate event arguments.
As for filtering and sorting, you might try the following.
1) External Filtering. I have attached a sample project that demonstrates one possible approach for external filtering. Basically, you keep the filtering UI intact but when the moment comes (i.e. when the user clicks ApplyFilter) it is your turn to somehow perform external filtering. You totally dump the built-in RadGridView filtering and you do the filtering on the outside. RadGridView will never ever know what's going on. When the user clicks the button, you will have to read what he has entered in the UI by reading the ColumnFilterDescriptor of the respective column and decide what to tell your WCF Service. You will have to keep track of all columns that are currently filtered of course.
2) Custom sorting. It is possible to perform external sorting as well. This help article
describes how to do custom sorting. So basically when the user sorts you will have to tell your WCF Service what to return.
So what you can do is the following. Have an in-memory ObservableCollection<T> on the client and bind the grid to this collection. When the user filters or sorts, tell your WCF Service what to return and wait. You can even turn on a BusyIndicator if you want while the client is waiting. Once a chunk of data arrives on the client, append it or clear and add it to the ObsevableCollection and the ObservableCollection will tell the grid what has happended and the grid will refresh accordingly. Your observable collection will the client view of your server data -- filtered and sorted as needed.
This is the only possible approach I can think of that does not involve implementing a custom ICollectionView on the client which is quite complex in my opinion.
If you have the source code of our controls, you can see that we have done something very similar in our QueryableDataServiceCollectionView<T>
. This is the client collection view that we use for WCF Data Services. Basically, when you bind the grid to such a collection, the grid will apply its filter and sort criteria to this collection, the collection will take them and translate them on the DataServiceQuery<T> it wraps, which is an IQueryable, and then it will call the server with this query and start waiting for data. Once the data arrives to the client, this collection will take the results and place them in an ObservableCollection that is wrapped inside it. Then it will notify the grid that it needs to enumerate it because data has changed.
So you get the idea. You will need to do something similar. It does not have to be wrapped in a standalone collection view class, but this is an architectural decision.
All the best,
the Telerik team