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

Bug in declarative data-row-template attribute for grid

1 Answer 95 Views
Grid
This is a migrated thread and some comments may be shown as answers.
Adam
Top achievements
Rank 1
Adam asked on 19 Apr 2013, 02:40 AM
I've found a bug in the latest release of Kendo UI for the grid.

Given a grid definition like:

<div data-role="grid" data-row-template="#= data.something #"></div>


Will not work correctly.  I've traced the problem to the 'parseOptions' function where it calls:

if (templateRegExp.test(option)) {


This method ALWAYS returns true because the value of 'option' is always 'rowTemplate'.  I believe the fix is to change this code to:

if (templateRegExp.test(value)) {


Which will correctly indicate if the value supplied for the 'data-row-template' attribute is an inline template, or the ID of script element that contains a template.

Please let me know when a fix is available. thanks.

1 Answer, 1 is accepted

Sort by
0
Nikolay Rusev
Telerik team
answered on 19 Apr 2013, 07:36 AM
Hello Adam,

data-row-template (as any data-template) attribute expects the id of the element that contains the template, not the template itself.

Here is a example for this: http://demos.kendoui.com/web/mvvm/source.html

The Grid configuration in your case must be similar to:

<div data-role="grid" data-row-template="gridRowTemplate"></div>
 
<script id="gridRowTemplate" type="text/x-kendo-template">
<tr> <!--you will need to handle tr and td elements too in row template -->
 <td>
   #= data.something #
  </td>
 </tr>
</script>

Regards,
Nikolay Rusev
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
Adam
Top achievements
Rank 1
Answers by
Nikolay Rusev
Telerik team
Share this question
or