Kendo DatePicker on Kendo Template

1 Answer 145 Views
Date/Time Pickers Templates
KoreanTea
Top achievements
Rank 1
KoreanTea asked on 17 Feb 2022, 02:51 PM | edited on 18 Feb 2022, 02:41 AM

Hi,

How can i render a kendo datepicker inside a kendo script template? With the help of javascript?

here is a simple sample: 


<script id="user-template" type="text/x-kendo-template">
<div id="column">
      <input id="datePicker1" />
</div>
</script>

1 Answer, 1 is accepted

Sort by
0
Neli
Telerik team
answered on 22 Feb 2022, 11:09 AM

Hello Juan,

You could use an element rendered in the template and initialize the Kendo widget when the page is loaded. Below is an example:

    <script type="text/x-kendo-template" id="myTemplate">
        <input id="datePicker" />
    </script>

    <div id="example" />
    <script>
      $(function() {
        $("#datePicker").kendoDatePicker();
      });
      var templateContent = $("#myTemplate").html();      
      var template = kendo.template(templateContent);
      $("#example").html(template);
    </script>

Here is a Dojo example where this is dmeonstrated.

Regards,
Neli
Progress Telerik

Love the Telerik and Kendo UI products and believe more people should try them? Invite a fellow developer to become a Progress customer and each of you can get a $50 Amazon gift voucher.

Tags
Date/Time Pickers Templates
Asked by
KoreanTea
Top achievements
Rank 1
Answers by
Neli
Telerik team
Share this question
or