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

Initialize Grid Options from Serialized JSON String

3 Answers 77 Views
Grid
This is a migrated thread and some comments may be shown as answers.
The Bearded One
Top achievements
Rank 1
The Bearded One asked on 19 Feb 2015, 08:31 PM
We allow our users to optionally save the state of their grids and persist them in the db. When a user comes back to he screen, they see the standard grid display just for a moment, then it updates their grid via JavaScript ( setOptions call) as it applies their persisted state settings. This makes it look like it's doing a double load. 

We would rather just initialize the grid with their persisted settings (via serialized json string) so the grid shows correctly on the initial load.

Is this possible?

We are using MVC.

Thanks!

3 Answers, 1 is accepted

Sort by
0
Dimo
Telerik team
answered on 23 Feb 2015, 08:58 AM
Hi Mark,

The desired behavior is possible to achieve if you modify your implementation to avoid the unconditional Grid initialization with the default settings of the server declaration. There are two ways to do that:

1. Replace the MVC wrapper with a client-side Grid and execute the Javascript initialization statement conditionally.

2. Defer the Grid initialization statement, which is rendered by the MVC wrapper and wrap it in a condititonal statement.

http://docs.telerik.com/kendo-ui/aspnet-mvc/fundamentals#deferred-initialization

Generally, when working with Grid states, it is simpler to use the client-side Grid widget, because otherwise you are likely to end up with supporting two types of initialization at the same time.

Regards,
Dimo
Telerik

Check out the Telerik Platform - the only platform that combines a rich set of UI tools with powerful cloud services to develop web, hybrid and native mobile apps.

 
0
The Bearded One
Top achievements
Rank 1
answered on 23 Feb 2015, 11:11 AM
Thanks for the tips!

If I change to a client side grid widget and do initialization there, which method(s) do I use to initialize the grid with my persisted state settings? I did not see a way to send in my serialized string.

Thanks again...
0
The Bearded One
Top achievements
Rank 1
answered on 23 Feb 2015, 11:12 AM
Wait a moment, I would just use the setOptions method I'm already using! Never mind :)

The rule to note here is not to post questions before the first cup of coffee!

Thanks for the help!
Tags
Grid
Asked by
The Bearded One
Top achievements
Rank 1
Answers by
Dimo
Telerik team
The Bearded One
Top achievements
Rank 1
Share this question
or