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

How to declaratively set MVVM data column template to external template?

2 Answers 412 Views
Grid
This is a migrated thread and some comments may be shown as answers.
Nikola
Top achievements
Rank 1
Nikola asked on 31 May 2013, 09:56 AM
Hello,

I am struggling with declarative setting grid column to a external template

Here's my template
<script type="text/x-kendo-template" id="someTemplate">
    <div>
        <label> ${firstName}</label>  
        <label>${lastName}</label>
    </div>
</script>
and here's the grid declaration
<div data-role="grid" data-bind="source: people" data-columns='[
    {"field": "firstName",
     "title": "Full Name",
     "template": "kendo.template($("#someTemplate"))"
    }
]'></div>
And here's JS Fiddle reproducing my problem
http://jsfiddle.net/malovicn/bSGdW/8/

Anyone knowing how to fix that JS fiddle? :)

2 Answers, 1 is accepted

Sort by
0
Alexander Valchev
Telerik team
answered on 04 Jun 2013, 09:05 AM
Hi Nikola,

Thank you for getting in touch with us.
I am afraid that what you would like to achieve is not supported at present. If the declarative initialization is used, the column template should be set to an inline string. Data attributes are not JavaScript, which is why calling kendo.template will not work.

Regards,
Alexander Valchev
Telerik
Join us on our journey to create the world's most complete HTML 5 UI Framework - download Kendo UI now!
0
Accepted
Nikola
Top achievements
Rank 1
answered on 04 Jun 2013, 02:43 PM
Hi Alexander,

funny thing is that I already got my answer on SO and it works :)

Here's my JSfiddle fixed as I asked
http://jsfiddle.net/bSGdW/9/

Thanks!
Tags
Grid
Asked by
Nikola
Top achievements
Rank 1
Answers by
Alexander Valchev
Telerik team
Nikola
Top achievements
Rank 1
Share this question
or