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

[Solved] Loading persisted state after grid load

3 Answers 206 Views
Grid
This is a migrated thread and some comments may be shown as answers.
Tharindu
Top achievements
Rank 1
Tharindu asked on 05 Jan 2015, 09:13 AM
I'm working in page where user has the freedom to change the grid filters, order, etc. and when leaving the page it will save the state to local storage using the http://demos.telerik.com/kendo-ui/grid/persist-state feature available.

However when loading the state I'm currently doing in in dataBound but it throws out a error in console. I'm thinking that this has to do something with grid render because if I set a timeout in dataBound it loads the state perfectly.

This is the dojo I created. (Please change something in grid and save first, then run)
http://dojo.telerik.com/uNasI/4

3 Answers, 1 is accepted

Sort by
0
Vladimir Iliev
Telerik team
answered on 07 Jan 2015, 09:14 AM
Hi Tharindu,

Using the "dataBound" event in current case is invalid setup as it will cause the grid to reload in endless loop as this event is triggered after setting the options. If you need to restore the options after the page is loaded then you should place the code after the grid initialization code.  

Regards,
Vladimir Iliev
Telerik
 
Join us on our journey to create the world's most complete HTML 5 UI Framework - download Kendo UI now!
 
0
Tharindu
Top achievements
Rank 1
answered on 12 Jan 2015, 07:39 AM
Hi,

Thanks for the reply. I'm using an Angular based application. If I put the code after the initialization code it doesn't work as expected. I'm guessing that since this is not invoked at document ready event the grid is not rendered therefore an error is thrown.
0
Vladimir Iliev
Telerik team
answered on 12 Jan 2015, 08:33 AM
Hi Tharindu,

The code should be executed when the grid is initialized - therefor you should find the correct place for this code. If you find any difficulties implementing it, please provide runable project which replicates your scenario. This way we will get better overview of the exact setup that you have and advice you better how to proceed. 

Regards,
Vladimir Iliev
Telerik
 
Join us on our journey to create the world's most complete HTML 5 UI Framework - download Kendo UI now!
 
Tags
Grid
Asked by
Tharindu
Top achievements
Rank 1
Answers by
Vladimir Iliev
Telerik team
Tharindu
Top achievements
Rank 1
Share this question
or