简体   繁体   English

如何使用Kendo禁用和启用复选框

[英]How to disable and enable checkboxes with Kendo

I have grid table in that Im adding checkboxes by using kendo and now I want to disable one check box based upon comments which i have in grid itself. 我在网格表中,我通过使用kendo添加复选框,现在我想基于网格本身中的注释禁用一个复选框。 so please help to resolve it. 因此,请帮助解决该问题。

{ field: "Decline", tilte: commonLib.readMessageByUserLanguage(COLUMNTITLENAME.Decline), "template": "<input type=\"checkbox\" />" },
                    { field: "Item", tilte: commonLib.readMessageByUserLanguage(COLUMNTITLENAME.Item) },
                    { field: "PartID", title: commonLib.readMessageByUserLanguage(COLUMNTITLENAME.PartID) },
                    { field: "Description", title: commonLib.readMessageByUserLanguage(COLUMNTITLENAME.Description), width:'300px' },
                    { field: "SubPart", title: commonLib.readMessageByUserLanguage(COLUMNTITLENAME.SubPart) },
                    { field: "SubPartDescription", title: commonLib.readMessageByUserLanguage(COLUMNTITLENAME.SubPartDescription) },
                    { field: "BusinessPartner", title: commonLib.readMessageByUserLanguage(COLUMNTITLENAME.BusinessPartner) },
                    { field: "ReqDelTM", title: commonLib.readMessageByUserLanguage(COLUMNTITLENAME.ReqDelTM) },
                    { field: "EarDelTM", title: commonLib.readMessageByUserLanguage(COLUMNTITLENAME.EarDelTM) },
                    { field: "EarDelDate", title: "Ear Del Date", hidden: true },
                    { field: "Comments", title: commonLib.readMessageByUserLanguage(COLUMNTITLENAME.Comments) }
                ]
            });

Try: 尝试:

"template": "<input type=\"checkbox\" # if (checkComments(data.Comments)) { ##=disabled=\"disabled\" # } # />"

And in you must create a global function like: 并且您必须创建一个全局函数,例如:

let checkComments = function checkComments(comments) {
    return true; // Return true to disable
}

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM