Declined
Last Updated: 28 Oct 2021 13:17 by John
John
Created on: 25 Oct 2021 21:52
Category: Grid
Type: Bug Report
0
grid bug setoptions

there seems to be a bug in your commands column and it's made worse when loading/saving grid layouts.

When i load a page with this grid column definition, 


.Groupable()
                    .Columns(columns =>
                    {
                        columns.Command(cmd => cmd.Custom("Undelete")
                            .Click("undelete"))
                            .Width(60);

when you inspect the grid, the grid internally shows two classes for the command cell:

attributes{class'k-command-cell k-command-cell'}

now, if i apply a grid layout, the problem gets worse.  This sample code will cause the dom to end up with multiple k-command-cell classes on the grid's td element.


$("#UndeleteGrid").data("kendoGrid").setOptions($("#UndeleteGrid").data("kendoGrid").getOptions())
After running this, just two times, i ended up with this:

<td class="k-command-cell k-command-cell k-command-cell k-command-cell k-command-cell k-command-cell k-command-cell k-command-cell k-command-cell" role="gridcell"><a role="button" class="k-button k-grid-Undelete" href="#" title="Undelete"><span class="k-icon k-i-undo"></span></a></td>


2 comments
John
Posted on: 28 Oct 2021 13:17
I don't have an issue i'm stuck with.  We have saved layouts available on all our grids that, as it happens, we looked off of that sample to write.  I discovered that the command column was not working for custom buttons.  because stringify messes up javascript.  In an attempt to keep the value i noticed this duplication of classes going on.
ADMIN
Yanislav
Posted on: 28 Oct 2021 07:52

Hello John,

Thank you for writing to us!

I saw what's the problem and I'll be glad to help you, if you can give me more information about what exactly you are trying to do, because these functions are not supposed to be used this way.

For more information about the persist state you can read more in the Description section of this demo:

https://demos.telerik.com/kendo-ui/grid/persist-state

These two functions ('setOptions' & 'getOptions') are used together to persist the state as it's shown in the linked demo.

If u just want to change an option in the Grid, you can use 'setOptions' without passing 'getOptions'.

Regards,
Yanislav
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/.