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

"click" missing from getOptions() on columns

2 Answers 225 Views
Grid
This is a migrated thread and some comments may be shown as answers.
Jon
Top achievements
Rank 1
Jon asked on 08 Nov 2017, 03:22 PM

I am adding a click function to a column containing a button like so

            .Columns(columns =>
            {
                columns.Command(command =>
                {
                    command.Custom("customedit").Click("openScanLines").Text("").HtmlAttributes(new { title = "View Scan Details"});
                }).Width(75);
            })

We have an option to save the grid options to be loaded a later point.  So we use $("MyGrid").data("kendoGrid").getOptions() to get the options on the grid, Stringify it, and save it to a database  Then we pull that JSON string from the database and use $("MyGrid").data("kendoGrid").setOptions(options) to load them. The problem is the "Click" function is always missing from the $("MyGrid").data("kendoGrid").getOptions(), resulting in the Click function no longer working when the option are then set.  What's the deal?  How can I retain the click function for these columns?

  

2 Answers, 1 is accepted

Sort by
0
Jon
Top achievements
Rank 1
answered on 08 Nov 2017, 04:04 PM
EDIT:  it happens during the Stringify
0
Stefan
Telerik team
answered on 10 Nov 2017, 08:26 AM
Hello, Jon,

Thank you for the details.

This is expected scenario which is described in our documentation:

https://docs.telerik.com/kendo-ui/api/javascript/ui/grid#methods-setOptions

Also, the following KB article is showing a possible approach how this can be resolved:

https://docs.telerik.com/kendo-ui/knowledge-base/persist-state-and-function-references 

I hope this is helpful.

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
Jon
Top achievements
Rank 1
Answers by
Jon
Top achievements
Rank 1
Stefan
Telerik team
Share this question
or