This is a migrated thread and some comments may be shown as answers.

How can I set popup editor's template?

1 Answer 117 Views
Grid
This is a migrated thread and some comments may be shown as answers.
kim
Top achievements
Rank 1
kim asked on 16 Sep 2014, 07:20 AM
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>

1 Answer, 1 is accepted

Sort by
0
Alexander Popov
Telerik team
answered on 18 Sep 2014, 07:06 AM
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!
 
Tags
Grid
Asked by
kim
Top achievements
Rank 1
Answers by
Alexander Popov
Telerik team
Share this question
or