Kendo ui KendoUI网格-如何声明性地将MVVM数据列模板设置为外部模板?
我正在努力将网格列声明性设置为外部模板 这是我的模板Kendo ui KendoUI网格-如何声明性地将MVVM数据列模板设置为外部模板?,kendo-ui,Kendo Ui,我正在努力将网格列声明性设置为外部模板 这是我的模板 <script type="text/x-kendo-template" id="someTemplate"> <div> <label> ${firstName}</label> <label>${lastName}</label> </div> </script> ${firstName}
<script type="text/x-kendo-template" id="someTemplate">
<div>
<label> ${firstName}</label>
<label>${lastName}</label>
</div>
</script>
${firstName}
${lastName}
这是网格声明
<div data-role="grid" data-bind="source: people" data-columns='[
{"field": "firstName",
"title": "Full Name",
"template": "kendo.template($("#someTemplate"))"
}
]'></div>
下面是JS Fiddle重现我的问题:
您的代码中有两个错误:
"template": kendo.template($("#someTemplate").html())
看看这个JSIDLE:在几个小时的到期后,我发现 模板:kendo.template($(“\\\\\检查结果模板”).html() 所以只要注意“#”就可以了,无论你在哪里使用剑道