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

Rebinding / Updating while maintaining selection, position, expansion

11 Answers 385 Views
GridView
This is a migrated thread and some comments may be shown as answers.
Tim
Top achievements
Rank 1
Tim asked on 26 May 2009, 02:37 PM
Hi All,

I'm investigating Silverlight for the next revision of the product.  I'm generally quite happy with the ASP.NET Ajax controls.  One of the biggest pain points though is handling (near) real-time updates of data in RadGrid / GridView.  Right now (using the ASP.NET Ajax controls), we rebind on a manual refresh, initiated by the user, as the rebind loses the expanded detail view(s), the row selection, etc.  A quick examination by a colleague indicates this remains true with the GridView control in Silverlight.

The behavior we want is similar to the Windows Explorer or the Task Manager - where you can select one or more items, change the sort order, etc., and not lose either while at the same time objects (files, process, tasks, etc.) can come and go and the view updates in (near) real-time.

Anyone have any suggestions for achieving this goal?  Of course a built-in option would be best... I'd rather not keep a second, hidden grid from which I could use JS to update only individual cells, assuming that is even possible.  This approach sounds like it may slow things down even more.

I'll cross-post this to the ASP.NET Ajax RadGrid forum as well.

Thank you,
Tim

11 Answers, 1 is accepted

Sort by
0
Milan
Telerik team
answered on 29 May 2009, 05:20 PM
Hello Tim,

First let me thank you for your feedback.
Currently RadGridView is preserving the selection when you perform grouping and filtering and we are working on preseving the selection after sorting. I am sending you a sample project that demonstrates how you can preserve the selection after sorting (sample uses our SP2 assemblies which are required for using the Sorted event).

As far as preservation of the expanded state is concerned I am not sure if such feature would be welcomed by everyone. Maybe there should be a property to turn it on/off. Anyway, we will take this feature request into consideration. For the time being such feature could be implemented in a similar manner to the selection preservation that you can find in my sample or better yet the expanded state can be stored in a ViewModel.

Hope this helps.


Sincerely yours,
Milan
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
Tim
Top achievements
Rank 1
answered on 29 May 2009, 05:39 PM
I'll take a look, thanks.  You don't specifically mention my biggest concern which is the rebind -- the "complaint" we have is that our grid is not real-time enough.  The reason we don't automatically update (either by polling, or by a callback) is because there may be a complex selection or expansion in progress and rebinding destroys the work-in-progress.

So, we can potentially detect that the user has done "something" and ignore any timer-based rebinds (until they are doing nothing.)  Ideally I want a rebind to simply update those changes in the model (individual cells if you will) which have changed.

Preserving the state(s) on sort or group operations is also nice, but not as important, priority-wise.

Tim

0
Milan
Telerik team
answered on 01 Jun 2009, 01:46 PM
Hi Tim,

I have mentioned the rebind problem in the context of expand state preservation.
A possible workaround for the current limitation is to create a ViewModel that wraps your data. For example, the View can listen to change notifications of the original data but do not propagate them to the grid automatically. Once the user rebinds the View will propagate the changes and also reinitialize the state of all records (expand state for example).

In case you only need to preserve expansion you can just save the expand state of each row before rebind and after that manually reinitialize it.

We understand that both approaches require extra effort to implement and use, but for the time being this is the only way to achieve the functionality that you require.

We will try to provide better support for such scenarios in future releases.

Regards,
Milan
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
Tushar Mehere
Top achievements
Rank 1
answered on 24 Nov 2009, 10:45 PM
From the given sample.. i found that my code is missing DataRecord class. I have referenced Telerik,Windows.Data and couldn't find it. However the old dlls has it.

Could you please provide the namespace where i could find DataRecord class?

Thanks,
Tushar


0
Milan
Telerik team
answered on 29 Nov 2009, 09:22 AM
Hello Tushar Mehere,

I am wondering you are using our latest version Q3 or an older one? If you are using the latest once there is no need to preserve the selection - it is automatically preserved after filtering, sorting, etc. 

Regards,
Milan
the Telerik team

Instantly find answers to your questions on the new Telerik Support Portal.
Watch a video on how to optimize your support resource searches and check out more tips on the blogs.
0
James
Top achievements
Rank 1
answered on 01 Dec 2009, 08:47 AM
Hi Milan,

Does Q3 support the preservation of expanded child hierarcy gridview controls after a Rebind() operation?

From what I can see it almost works, when calling Rebind() on the top most RadGridView the first sub-level of expanded GridView controls correctly hold their expanded/collapsed state, but after the first level all bets are off - all further child GridView controls are collapsed down.

This would be a great feature for people like Tim and myself who need to maintain a real-time representation of the RadGridView with a child hierarchy (e.g. Windows Explorer).

Regards,
James.
0
Tim
Top achievements
Rank 1
answered on 01 Dec 2009, 02:06 PM

James wrote:
This would be a great feature for people like Tim and myself who need to maintain a real-time representation of the RadGridView with a child hierarchy (e.g. Windows Explorer).

That would be very nice.
Tim

0
Milan
Telerik team
answered on 04 Dec 2009, 07:36 AM

Hi buys,

We have logged this feature request and we will implement the feature as soon as possible. 
Thanks for your feedback.


Sincerely yours,
Milan
the Telerik team

Instantly find answers to your questions on the new Telerik Support Portal.
Watch a video on how to optimize your support resource searches and check out more tips on the blogs.
0
Diptimaya
Top achievements
Rank 1
answered on 23 Nov 2011, 08:07 AM
Hi Milan,

I am using Q3 2011 Silverlight controls.

Does Q3 support the preservation of expanded child hierarcy gridview controls after a Rebind() operation?

Thanks
0
Diptimaya
Top achievements
Rank 1
answered on 12 Dec 2011, 02:44 PM
Any update on this?

Thanks
0
Tyree
Top achievements
Rank 2
answered on 12 Dec 2011, 10:26 PM
I would suspect no.

Instead of rebinding, why not manipulate your observable collection by adding, removing, updating items. This will allow the grid to maintain its visual state.

Maintaining state after a rebind is pretty tall order - doable but probably not good form.
Tags
GridView
Asked by
Tim
Top achievements
Rank 1
Answers by
Milan
Telerik team
Tim
Top achievements
Rank 1
Tushar Mehere
Top achievements
Rank 1
James
Top achievements
Rank 1
Diptimaya
Top achievements
Rank 1
Tyree
Top achievements
Rank 2
Share this question
or