Tuesday, 19 January 2016

Using Kendo Templates

First our template
<script id="data_upload_result_confirmation" type="text/x-kendo-template">
    <h4>#= firstname # is this information correct?</h4>

    <p style="text-align:center;">
        <button class="delete-confirm k-button">Ok</button>
        <a href="javascript:" class="delete-cancel">no</a>
    </p>

</script> 

Then the code to transform the data then open the window
<script>    

  var kendoWindow = $("<div />").kendoWindow({
      title: "Confirm",
      resizable: false,
      width: 550,
      modal: true
  });

  var template = kendo.template(
      $('#data_upload_result_confirmation').html());    
  var data = { firstname: "Rippo" };    
  var result = template(data);


  kendoWindow.data("kendoWindow")
    .content(result)
    .center().open();

</script>