javascriptjqueryasp.net-mvckendo-schedulerkendo-template

Calling a text/x-kendo-template script type from a javascript function


I have this new button and on onclick event I'm calling function openEditor(), and inside this function I want to call a text/x-kendo-template script type. How can I do this?

My code right now:

Custom button:

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>"
)

Function openEditor():

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

Template script:

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

edit: I'm using a kendo scheduler and I've added that custom button on toolbar.


Solution

  • The following code was enough:

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