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

时间:2019-08-28 15:21:12

标签: javascript jquery kendo-ui kendo-grid

我有网格表,我通过使用kendo添加复选框,现在我想根据我在网格本身中的注释禁用一个复选框。因此,请帮助解决该问题。

{ 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) }
                ]
            });

1 个答案:

答案 0 :(得分:0)

尝试:

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

并且您必须创建一个全局函数,例如:

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