0

文本/ X-剑道模板脚本型我this新的按钮和onclick事件我打电话功能openEditor(),而这个函数中我要调用一个text/x-kendo-template脚本类型。我怎样才能做到这一点?从调用一个JavaScript函数

我现在代码:

自定义按钮

schedulerToolbar.append(
"<ul class='k-reset'> 
    <li class='k-state-default'> 
    <a role='button' href='#' class='k-link newMeetingButton' onclick='openEditor()'> 
     Nova reserva 
    </a> 
    </li> 
</ul>" 
) 

功能openEditor()

function openEditor() { 
    *code to call customEditorTemplateBh script* 
} 

模板脚本

<script id="customEditorTemplateBh" type="text/x-kendo-template"> 
    *template code* 
</script> 

编辑:我正在使用kendo计划程序,并在工具栏上添加了该自定义按钮。通过调用template作为函数

var template = kendo.template($("#customEditorTemplateBh").html()); 

从这里你可以提供您的模板所需的所有数据:

回答

0

下面的代码已经足够:

var scheduler = $("#scheduler-bh").data("kendoScheduler"); 
scheduler.addEvent({ }); 
0

您可以通过使用kendo.template()将选择的id参考模板访问它,你的情况

var data = {Attribute1: "Test", Attribute2: Test2}; 

var result = template(data); 

最后,通过设置您所使用的结果无论<div>的的html更新您的看法:

$("#nameOfYourDivHere").html(result); 

模板的参考材料可以找到here