【发布时间】:2014-10-23 21:56:51
【问题描述】:
我正在尝试将上下文菜单连接到 JSON 数据源,但我似乎无法设置模板。
如果我有这样的数据源(在文档中指定)
var dataSource = [{
text: "hello",
imageUrl: "pencil_icon.png",
content: "I'm on the side"
}]
一切都很好,花花公子(我想它正在使用一些默认模板)
但是,如果我尝试使用自己的模板,一切都是未定义的。
<script type="text/x-kendo-template" id="contextMenuTemplate">
<li data-action="#=onClickJavascript#"><img src="@Web_Helpers.StratosphereImageUrl("#=image#")" /> #=text#</li>
</script>
var dataSource = [{
text: "bonjour",
image: "@@Pencil_Icon",
onClickJavascript: "alert('hello');"
}]
var menu = $("#contextMenu").kendoContextMenu({
template: kendo.template($("#contextMenuTemplate").html()),
dataSource: dataSource,
....
如何在剑道上下文菜单中使用模板?
【问题讨论】:
标签: kendo-ui kendo-contextmenu