Unplanned
Last Updated: 07 Jan 2021 12:08 by ADMIN
Meliton Pablo
Created on: 07 Jan 2021 11:55
Category: Grid
Type: Feature Request
3
The Grid Toolbar disappears when using setOptions

I use getOptions() and setOptions() to persist the state of the ajax bound grid that I have.

My toolbar is not a server one, it is this:

.ToolBar(toolbar =>toolbar.Create().HtmlAttributes(new { @class ="k-primary"}))

When I call the setOptions() method, it removes the Add button from the grid header.

1 comment
ADMIN
Alex Hajigeorgieva
Posted on: 07 Jan 2021 12:08

Hello, Meliton Pablo,

Thank you for your feedback.

Until we implement the toolbar serialization in such a way that it works out of the box, you can use the following workaround to restore the button.

var grid = $("#grid").getKendoGrid();
var options = grid.getOptions();
options.toolbar = [{ name: "create", attr: { "class": "k-primary"} }];
grid.setOptions(options);

Any of the other alternatives in the Grid API will also work. For a reference of the expected structure, check this section of the API:

https://docs.telerik.com/kendo-ui/api/javascript/ui/grid/configuration/toolbar

Kind Regards,
Alex Hajigeorgieva
Progress Telerik

Virtual Classroom, the free self-paced technical training that gets you up to speed with Telerik and Kendo UI products quickly just got a fresh new look + new and improved content including a brand new Blazor course! Check it out at https://learn.telerik.com/.