且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

根据另一个列值启用或禁用kendo网格列

更新时间:2022-12-09 15:49:09

我在剑道网格中有类似的情况.您应该知道的一件事是,当网格进入编辑模式时,该行的字段将被聚焦.从这个角度来看,您可以做我所做的事情.

I had a similar case in a kendo grid. One thing you should know is that when the grid gets in edit mode the fields of the row are focused. From that point of view you could do what I did.

A.当网格进入编辑模式时,可以使用字段名称(示例中为Roll)来调用您的复选框.在编辑事件中,您应该检查Roll元素是否被选中.您将获得的值将是该行的值.那时,您可以将输入(我猜为RollUpName)设置为禁用

A. When the grid enters the edit mode your checkbox can be called with the name of the field (Roll in your example). In the edit event you should check if the Roll element is checked. The value you will get will be tho row's value. At that point you can just set your input (I'm guessing RollUpName) to disabled

$("#RollUpName").prop("disabled", true);

为了动态工作,您应该在复选框的change事件上添加事件侦听器.可能通过使用某些类并将其输入到您的客户端模板中.每次更改复选框时,都会更改的复选框将位于可编辑的行中.此时,您可以用相同的方式更改RollUpName的可编辑模型.

In order to work dynamically you should add an event listener on the change event of your checkboxes. Possibly by using some class and enter it to your client template. On every change of the checkbox, the checkbox that will have changed will be in the editable row. At that point you can change the editable model of the RollUpName the same way.