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

Questions on getOptions and setOptions

7 Answers 324 Views
Grid
This is a migrated thread and some comments may be shown as answers.
Marc
Top achievements
Rank 1
Marc asked on 17 May 2017, 04:34 PM

I'm working on a large grid (dozens of columns, thousands of rows). The grid is loading the entire dataset on the client (serveroperation = false) and using virtual scrolling.

 

We are allowing users to save multiple states which are persisted in a database and selected with a dropdown menu. The dropdown initiates an ajax call which gets the options (in json) from the database and applies it to the grid.

 

I would like to have the settings applied without reloading the data from the client. I have tried creating a handler for onDataBinding but it doesn't work. What is the best way to accomplish this?

 

Also, is there an easy way to reset all of the settings including re-ordering all the columns back to their original position. I found a function to do this on the web, but it takes 30 seconds for the number of columns we have which is unacceptable.

 

 

7 Answers, 1 is accepted

Sort by
0
Stefan
Telerik team
answered on 19 May 2017, 08:22 AM
Hello Marc,

In general, using the setOptions method will always initiate a new read, as the options and the data may be changed.

Still, I can suggest a custom approach which will use the old data.

When an old state of the Grid is selected, save the current data in a variable and use a flag to show that the read method has to be prevented.

Then on the requestStart event, based on the flag prevent the read call.

After that when the new options are restored, use the data method of the dataSource to set the old data which was saved in a variable:

http://docs.telerik.com/kendo-ui/api/javascript/data/datasource#events-requestStart

http://docs.telerik.com/kendo-ui/api/javascript/data/datasource#methods-data

This will create a scenario, where the data is reused and a call to the server is prevented.

I hope this approach to be helpful.

Regards,
Stefan
Telerik by Progress
Try our brand new, jQuery-free Angular 2 components built from ground-up which deliver the business app essential building blocks - a grid component, data visualization (charts) and form elements.
0
Marc
Top achievements
Rank 1
answered on 19 May 2017, 02:50 PM
Ok thanks I'll give your suggestion a try. Wouldn't the existing data already be stored as a variable on the client though?
0
Stefan
Telerik team
answered on 23 May 2017, 07:23 AM
Hello Marc,

The data will be stored, but once the setOptions method is used, the old data will be replaced with the new one in order to free-up the space, as otherwise, this may cause a memory leak.

Regards,
Stefan
Telerik by Progress
Try our brand new, jQuery-free Angular 2 components built from ground-up which deliver the business app essential building blocks - a grid component, data (charts) and form elements.
0
Anurag
Top achievements
Rank 1
answered on 24 May 2018, 08:29 PM

Hi Stefan

What is the equivalent way in Angular 2+ to grid.getOptions() to get all the column settings to persist in an external data source. Is there a jQuery way of getting a reference to the grid and then call the getOptions()? or is there another recommended way to get the column options. If you can give an example that will be great. We are using Angular 5, Kendo UI R1 2018 release. We can move to Kendo UI R2 2018 release if needed.

0
Stefan
Telerik team
answered on 25 May 2018, 06:21 AM
Hello, Anurag,

When the Angular 2+ components are used the approaches are different due to the specifics of the Angular framework.

Could you please submit a support ticket for the Angular 2+ product so the relevant team can provide more detailed and specific answer to the question and advise how the desired result can be achieved.

Regards,
Stefan
Progress Telerik
Try our brand new, jQuery-free Angular components built from ground-up which deliver the business app essential building blocks - a grid component, data visualization (charts) and form elements.
0
Anurag
Top achievements
Rank 1
answered on 25 May 2018, 01:31 PM

Hi Stefan

Thanks for the quick response. Could you please tell me the best way to create a support ticket?

Thanks

0
Stefan
Telerik team
answered on 25 May 2018, 01:43 PM
Hello, Anurag,

I have opended a ticket for you an send it to the relevant team, you should receive a notification for it.

As for opening tickets, this can be done from the account page:





Regards,
Stefan
Progress Telerik
Try our brand new, jQuery-free Angular components built from ground-up which deliver the business app essential building blocks - a grid component, data visualization (charts) and form elements.
Tags
Grid
Asked by
Marc
Top achievements
Rank 1
Answers by
Stefan
Telerik team
Marc
Top achievements
Rank 1
Anurag
Top achievements
Rank 1
Share this question
or