关于javascript:自定义复选框在剑道网格中不可点击 | 珊瑚贝

Customized checkboxes are not clickable in kendo grid


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

我该如何解决这个问题?

这是我的代码

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
@( 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()
)

这里是我的复选框模板

1
2
3
function chk2(data) {
    return ‘<input id=”masterCheck’ + data.DayId + ‘” class=”k-checkbox” type=”checkbox” checked=”checked” /><label for=”masterCheck” class=”k-checkbox-label”></label>’;
}
  • demos.telerik.com/aspnet-mvc/grid/checkbox-selection
  • @GaloisGirl 我没有使用 columns.Select() 我正在使用客户端模板但仍然无法点击…


您的模板中有一个错误: label for=”masterCheck” 缺少 data.DayId 。

另请注意,复选框在 2020.1.114 版本中已更改,不再需要空标签。请参阅 https://demos.telerik.com/kendo-ui/checkbox/index 上的示例。出于可访问性原因,请记住提供 aria-label。

  • 哈哈!谢谢!我错过了
  • 你能帮我解决这两个问题吗? stackoverflow.com/questions/60411526/… stackoverflow.com/questions/60426643/…


DayId 应该在 DataSource

中可编辑

1
keys.Field(c => c.DayId).Editable(true);
  • 否,因为该值是整数,并且当其可编辑为 true 并单击它以显示文本框时,它会被复选框所掩盖


来源:https://www.codenong.com/60359857/

微信公众号
手机浏览(小程序)

Warning: get_headers(): SSL operation failed with code 1. OpenSSL Error messages: error:14090086:SSL routines:ssl3_get_server_certificate:certificate verify failed in /mydata/web/wwwshanhubei/web/wp-content/themes/shanhuke/single.php on line 57

Warning: get_headers(): Failed to enable crypto in /mydata/web/wwwshanhubei/web/wp-content/themes/shanhuke/single.php on line 57

Warning: get_headers(https://static.shanhubei.com/qrcode/qrcode_viewid_9979.jpg): failed to open stream: operation failed in /mydata/web/wwwshanhubei/web/wp-content/themes/shanhuke/single.php on line 57
0
分享到:
没有账号? 忘记密码?