Questions on getOptions and setOptions

8 posts, 0 answers
  1. Marc
    Marc avatar
    128 posts
    Member since:
    Jul 2010

    Posted 17 May 2017 Link to this post

    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.

     

     

  2. Stefan
    Admin
    Stefan avatar
    3009 posts

    Posted 19 May 2017 Link to this post

    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.
  3. Marc
    Marc avatar
    128 posts
    Member since:
    Jul 2010

    Posted 19 May 2017 Link to this post

    Ok thanks I'll give your suggestion a try. Wouldn't the existing data already be stored as a variable on the client though?
  4. Stefan
    Admin
    Stefan avatar
    3009 posts

    Posted 23 May 2017 Link to this post

    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 visualization (charts) and form elements.
  5. Anurag
    Anurag avatar
    2 posts
    Member since:
    Aug 2016

    Posted 24 May 2018 in reply to Marc Link to this post

    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.

  6. Stefan
    Admin
    Stefan avatar
    3009 posts

    Posted 25 May 2018 Link to this post

    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.
  7. Anurag
    Anurag avatar
    2 posts
    Member since:
    Aug 2016

    Posted 25 May 2018 in reply to Stefan Link to this post

    Hi Stefan

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

    Thanks

  8. Stefan
    Admin
    Stefan avatar
    3009 posts

    Posted 25 May 2018 Link to this post

    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.
Back to Top