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

Kendo declarative Grid templated column problems

1 Answer 106 Views
Grid
This is a migrated thread and some comments may be shown as answers.
Stanley
Top achievements
Rank 1
Stanley asked on 24 Aug 2012, 12:50 PM
Trying to get a templated column in a kendo grid declaratively.  Something like:

<div id="sitesGrid" data-role="grid" style="width: 800px;"
                 data-sortable="true"
                 data-columns='[{ "field": "accountName", "title": "Account", "width": "150px" }, 
                { "field": "subAccountName", "title": "Sub Account", "width": "180px" }, 
                { "field": "siteName", "title": "Site", "width": "150px" }, 
                { "field":  { "template": "#= <input type='checkbox' />"}, "width": "80px"}]'
                data-source="AuroraSurveyTool.lovs.siteList">

But this doesn't work.   Completely screws up the HTML.    Some help would be appreciated.  Don't have a clue what I'm doing wrong.  Been through every example I can find.    I don't really need a check box.  Could also use a simple CSS style to switch between icons, but that doesn't seem to work either.   I just need to display two different states (true/false) in a column and fire an event.

1 Answer, 1 is accepted

Sort by
0
Iliana Nikolova
Telerik team
answered on 29 Aug 2012, 11:26 AM
Hello Stanley,

If you want to render HTML in a template you do not need hash symbol ( "#" symbol is used to mark areas in a template that should be replaced with data when template is executed). To render a checkbox in the grid's column you could use the following code snippet: 
<div id="sitesGrid" data-role="grid" //...
    data-columns='[
      //....
      { "template" : "<input type=\"checkbox\">", "width": "80px"}]'
      //....>

I hope this helps.
 
Regards,
Iliana Nikolova
the Telerik team
Join us on our journey to create the world's most complete HTML 5 UI Framework - download Kendo UI now!
Tags
Grid
Asked by
Stanley
Top achievements
Rank 1
Answers by
Iliana Nikolova
Telerik team
Share this question
or