kendo-ui-core
kendo-ui-core copied to clipboard
Hidden Template column is showing in the Grid with Server Rendering
Bug report
A hidden template column that is not included in the ColumnMenu appears after showing another column
Reproduction of the problem
- Use the following declaration for the columns:
.Columns(columns =>
{
//Hidden template column
columns.Template(x =>
{
int rptIndex = Model.IndexOf(x);
string namePrefix = "Grid[" + rptIndex + "].";
Html.Hidden(namePrefix + "Id", x.Id, new { @readonly = "readonly" });
Html.Hidden(namePrefix + "Name", x.Name, new { @readonly = "readonly" });
}).Hidden().IncludeInMenu(false);
columns.Bound(x => x.Id).Width(120).Hidden(true);
columns.Bound(x => x.Name).Width(200);
columns.Bound(x => x.ReportingDateOriginal).Width(500).HtmlAttributes(new { id = "reporting-date-original" })
.Filterable(f => f.UI(GridFilterUIRole.DateTimePicker).Cell(c => c.Template("dateFilter")));
columns.Bound(x => x.Test1).Width(200).Hidden(true);
columns.Bound(x => x.TimezoneOffset).Width(200).HtmlAttributes(new { id = "reporting-date-offset" });
columns.Bound(x => x.Test2).Width(200).Hidden(true);
columns.Bound(x => x.ReportingDateAdjusted).Width(500).HtmlAttributes(new { id = "reporting-date-adjusted" })
.Filterable(f => f.UI(GridFilterUIRole.DateTimePicker).Cell(c => c.Template("dateFilter")));
columns.Bound(x => x.Test3).Width(200);
columns.Bound(x => x.Test4).Width(200).Hidden(true);
columns.Bound(x => x.Test5).Width(200);
})
- Show the Id column
Current behavior
The first time instead of the Id, the template column appears.
Expected/desired behavior
The Id column should appear and the template column should remain hidden.
Environment
- Kendo UI version: 2024.1.130
- Browser: [all]
Workaround: Add the following to the Template column:
.HtmlAttributes(new {style = "display:none;"})
Moving this to jQuery, as the issue seems to be caused by the fact that the server-rendering of the Grid includes a k-hidden
which is a scenario that is not handled there.