如何在 Kendo 网格列中显示复选框

How to display checkbox in Kendo Grid column

我试图在我的网格中显示一个复选框,但我一直 运行ning 出错。 我的复选框模板是这样的:{ field: "IsForeign", title: "Is <br/> Foreign", width: "120px", dataType: "bool", template: '<input type="checkbox" #= IsForeign == "true" ? checked="checked" : "" # />' } 但是我不断收到 'IsForeign' 未定义的错误。当我 运行 没有复选框模板的网格时,一切都正确呈现。

您必须在网格模式模型中定义 IsForeign 并以此替换您的代码。

<input type="checkbox" #= IsForeign? \'checked="checked"\' : "" # >

希望对你有所帮助:)