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

Creating KendoGrid from table

1 Answer 910 Views
Grid
This is a migrated thread and some comments may be shown as answers.
gm
Top achievements
Rank 1
gm asked on 19 Oct 2012, 02:38 PM
If I have a <th> element that has text where the first character is a numeric value (e.g. '1 Title'), the attempt to create a KendoGrid from the table fails.  For example, the following code fails, but if I replace '1 Title' with something like 'A1 Title', it works.  Is it suppose to work that way?

<
table id='OneTable'>
  <thead>
    <tr>
      <th>One Title</th>
      <th>1 Title</th>
    </tr>
  </thead>
  <tbody>
    <tr>
      <td>One Data</td>
      <td>1 Data</td>
    </tr>               
  </tbody>
</table>
 
<script type="text/javascript">
    $(document).ready(function () {
        $('#OneTable').kendoGrid();
    });
</script>

1 Answer, 1 is accepted

Sort by
0
Dimo
Telerik team
answered on 19 Oct 2012, 03:01 PM
Hi Gregg,

Your current setup causes Javascript properties to be created, which are based on the <th> content. This of course leads to invalid property names starting with a number. Please define data-field HTML attributes in the <th> tags:

http://demos.kendoui.com/web/grid/from-table.html

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