How can I set popup editor's template?

2 posts, 0 answers
  1. kim
    kim avatar
    3 posts
    Member since:
    Aug 2014

    Posted 16 Sep 2014 Link to this post

    How can I set popup editor's template?

    Following code does't work.
     

    <kendo:grid name="grid">
        <kendo:grid-editable confirmation="true"  mode="popup" template="editTemplate" />

    ...
    ...    

    <script type="text/x-kendo-template" id="editTemplate">   
        <input id="productId" type="text" >
        <input id="productName"  type="text" >
        <input id="unitPrice"  type="text" >
        <input id="unitsInStock"  type="text" >
    </script>
  2. Alexander Popov
    Admin
    Alexander Popov avatar
    1416 posts

    Posted 18 Sep 2014 Link to this post

    Hello Kim,

    I already addressed this query in the support ticket you opened, but I will share my suggestion here as well.

    This could be achieved using a function that returns the template's text. For example:  
    <script>
        function getTemplate(data) {
            return $("#editTemplate").html();
        }
    </script>
    ...
    <kendo:grid name="grid">
    <kendo:grid-editable confirmation="true"  mode="popup" template="#=getTemplate(data)#" />
    ...   
    <script type="text/x-kendo-template" id="editTemplate">  
        <input data-bind="value: productId" name="productId" type="text" >
        <input data-bind="value: productName" name="productName"  type="text" >
        <input data-bind="value: unitPrice" name="unitPrice"  type="text" >
        <input data-bind="value: unitsInStock" name="unitsInStock"  type="text" >
    </script>
     

    Regards,
    Alexander Popov
    Telerik
     
    Join us on our journey to create the world's most complete HTML 5 UI Framework - download Kendo UI now!
     
  3. UI for ASP.NET AJAX banner
Back to Top