Custom Command not working after setOptions

0 Answers 5 Views
Grid
Stefan
Top achievements
Rank 2
Iron
Iron
Iron
Stefan asked on 26 Aug 2025, 01:32 PM

We have this Command:

columns.Command(c =>
{
    c.Custom("Delete").Text(" ").Click("onClick").IconClass("k-icon k-i-trash").HtmlAttributes(new { @title = Resource.DELETE });
})

And we have this function to set the grid state:

function loadOptions() {
    var options = sessionStorage["userTable-options"];
    
    if (options) {
        var grid = $('#userTable').data('kendoGrid');
        var toolBar = $("#userTable .k-grid-toolbar").html();  // https://stackoverflow.com/questions/27717575/kendo-mvc-persist-and-load-grid-buttons

        var optionsJSON = JSON.parse(options);

        // https://docs.telerik.com/kendo-ui/knowledge-base/grid-persist-customized-filter
        var StatusTranslated = optionsJSON.columns.filter(function (c) { return c.field === "StatusTranslated.Text"; })[0];

        StatusTranslated.filterable = {
            ui: $.proxy(filterDropDownField, { field: 'StatusTranslated' })
        };

        grid.setOptions(optionsJSON);
        $("#userTable .k-grid-toolbar").html(toolBar);
        $("#userTable .k-grid-toolbar").addClass("k-grid-top");
    }
}

 

Before setting the grid state the button executes successfully. After executing setOptions the button does not work anymore.

How do we combine the possibility to save/load the grid state, and the usage of custom buttons in the grid?

 

Kind regards.

 

No answers yet. Maybe you can help?

Tags
Grid
Asked by
Stefan
Top achievements
Rank 2
Iron
Iron
Iron
Share this question
or