kendo 网格中的自定义复选框不可点击

Customized checkboxes are not clickable in kendo grid

我有 kendo 带有复选框选择列的网格,我自定义了这些复选框,但现在复选框不可点击,无法取消选中或选中

我该如何解决这个问题?

这是我的代码

@( Html.Kendo().Grid<MockUpForeNet.Controllers.CardDetailController.Days>()
     .Name("timegrid")
     .DataSource(d => d.Ajax().Read("TimeGridBinding", "CardDetail").Model(keys =>
     {
         keys.Id(k => k.DayId);
         keys.Field(c => c.DayName).Editable(false);
         keys.Field(c => c.DayId).Editable(false);
     }).PageSize(7))
               .Columns(c =>
               {
                   c.Bound(p => p.DayId).Width(100).Title(" ").ClientTemplate("#= chk2(data) #").Sortable(false);
                   c.Bound(e => e.DayName).Width("auto").Title("Day");
               })
       .Editable(editing => editing.Mode(Kendo.Mvc.UI.GridEditMode.InCell))
       .Sortable()
       .ColumnMenu()
)

这是我的复选框模板

function chk2(data) {
    return '<input id="masterCheck' + data.DayId + '" class="k-checkbox" type="checkbox" checked="checked" /><label for="masterCheck" class="k-checkbox-label"></label>';
}

DayId 应在 DataSource

中设为可编辑
keys.Field(c => c.DayId).Editable(true);

您的模板有误:缺少 label for="masterCheck" data.DayId

另请注意复选框有 changed in version 2020.1.114 and don't need the empty label anymore. See examples on https://demos.telerik.com/kendo-ui/checkbox/index 。出于可访问性原因,请记住提供 aria-label