I have a remote binding grid that is used to access several different external tables. I have a button that can apply a users saved options for the grid using the setOptions method. The issue I'm having is trying to get the grid to apply the users options when the data is loaded; ie the user clicks to a different table and the grid auto applies the options. My first attempt was using the dataBound event to call my setOptions method to apply the configuration, however this does not fire and is actually listed as not being possible in the documentation here: https://docs.telerik.com/kendo-ui/api/javascript/ui/grid/methods/setoptions
How can I get around this to have the setOptions method be called on a grid loading?
Thanks.
5 Answers, 1 is accepted
[quote]Josh said:Just call your set options function on the button click. This will cause the grid to refresh itself with the new settings.[/quote]
By button click, I mean when the user selects the "table" then call the setoptions function
Not the cleanest solution since it does require a setTimeout() to avoid it calling the method before the grid is loaded, but that does work nicely!
Thanks.
Hello, I am not sure if this is applicable to your situation, but you might be able to avoid using setTimeout() by setting the autobind property on the grid to false.
https://docs.telerik.com/kendo-ui/api/javascript/ui/grid/configuration/autobind
This will prevent the grid from loading data when it is initialized. It will then load the data when your user selects the table and the setOptions method is called.
I can confirm that Josh's suggestion about setting the autoBind configuration to false is the correct way of preventing the Grid from doing two read requests.
Regards,
Preslav
Progress Telerik