I am using the MVC helpers from telerik.ui.for.aspnetmvc.2023.2.829.commercial. When I do
@(Html.Kendo().Grid(Model.ServerColumnValues) .Name("NoKTableTd") .Selectable(select => select.Enabled(true).Type(GridSelectionType.Cell)) .DataSource(dataSource => dataSource .Server() .Model(model => model.Id(p => p.Value1)) ) .Columns(columns => { columns.Bound(c => c.Value1).Width("200px").HtmlAttributes(new { Class = "ct" }); columns.Bound(c => c.Text).Width("200px").HtmlAttributes(new { Class = "rt" }); }) .Scrollable(scrolling => scrolling.Virtual(false).Enabled(true)) .Sortable() .Pageable(paging => paging.Enabled(true) .PageSizes(false) .Input(false) .Info(true) .Numeric(false) .PreviousNext(false) .Messages(m => m.Display("Total Records: {2}"))) .Groupable(grouping => grouping.Enabled(false)) .Resizable(resize => resize.Columns(false)) )
the grid cells are rendered without a k-table-td class:
<tr class="k-table-row k-alt k-table-alt-row k-master-row" role="row">
<td class="ct" role="gridcell">1</td>
<td class="rt" role="gridcell">These grid cells do not have a k-table-td class</td>
</tr>
When I do
@(Html.Kendo().Grid(Model.AjaxColumnValues) .Name("NoHtmlAttributesClass") .Selectable(select => select.Enabled(true).Type(GridSelectionType.Cell)) .DataSource(dataSource => dataSource .Ajax() .PageSize(250) .ServerOperation(false) .Read(read => read.Action("_IndexData", "Home", null)) ) .Columns(columns => { columns.Bound(c => c.Value1).Width("200px").HtmlAttributes(new { Class = "ct" }); columns.Bound(c => c.Text).Width("200px").HtmlAttributes(new { Class = "rt" }); }) .Scrollable(scrolling => scrolling.Virtual(false).Enabled(true)) .Sortable() .Pageable(paging => paging.Enabled(true) .PageSizes(false) .Input(false) .Info(true) .Numeric(false) .PreviousNext(false) .Messages(m => m.Display("Total Records: {2}"))) .Groupable(grouping => grouping.Enabled(false)) .Resizable(resize => resize.Columns(false)) )
the grid cells are rendered without the classes specified in their HtmlAttributes:
<tr class="k-table-row k-master-row" data-uid="fe1fd9d6-7894-4421-b257-80c6732bd2f0" role="row">
<td class="k-table-td" role="gridcell">0</td>
<td class="k-table-td" role="gridcell">These grid cells do not have their HtmlAttributes class</td>
</tr>
This case seems related to
function decorateCellWithClass(html) {
var element = html;
var classes = element.match(/class=["][^"]+/g);
if (classes) {
var cssClasses = classes[0].split('\"').pop();
element = element.replace(cssClasses, cssClasses + " k-table-td");
} else {
element = element.replace("<td","<td class='k-table-td'");
}
return element;
}
"<td Class=\"ct\">"
I guess I should note it also happens with telerik.ui.for.aspnetmvc.2023.2.718.commercial but did not happen with telerik.ui.for.aspnetmvc.2021.3.1109.commercial.