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

Add grid to tables

1 Answer 65 Views
Grid
This is a migrated thread and some comments may be shown as answers.
Viktoria
Top achievements
Rank 1
Viktoria asked on 11 Feb 2016, 12:45 AM

I've got xslt file which consists of many tables. 
I set id to each table. How can I set grid on id?

<table class="grid" id="ID0EEC">
      <tbody><tr>
        <th>Numb</th>
        <th>Time</th>
        <th>Type</th> 
      </tr>
      <tr>
        <th>47217283640322</th>
        <th>10.01.2014 15:25:17</th>
        <th>ATM</th> 
      </tr>
      <tr>
        <th>46961091840322</th>
        <th>12.01.2014 09:07:47</th>
        <th>Kasino</th> 
      </tr>
      <tr>
        <th>46519990240322</th>
        <th>25.01.2014 22:47:00</th>
        <th>Cash</th> 
      </tr>
    </tbody></table>

 

<table class="grid" id="ID0EJG">
      <tbody><tr>
        <th>Numb</th>
        <th>Time</th>
        <th>Type</th> 
      </tr>
      <tr>
        <th>47217283640322</th>
        <th>10.01.2014 15:25:17</th>
        <th>ATM</th> 
      </tr>
      <tr>
        <th>46961091840322</th>
        <th>12.01.2014 09:07:47</th>
        <th>Kasino</th> 
      </tr>
      <tr>
        <th>46519990240322</th>
        <th>25.01.2014 22:47:00</th>
        <th>Cash</th> 
      </tr>
    </tbody></table>


I would like to do smth like thin in JS
  var gridArray = $("#grid");
        for (var i = 0; i < gridArray.length; i++) {
            var tmp = gridArray[i];
            var numb = tmp.getAttribute('id');
            $("#" + numb).kendoGrid({});
        } 

 

 

What is wrong?

1 Answer, 1 is accepted

Sort by
0
Patrick | Technical Support Engineer, Senior
Telerik team
answered on 11 Feb 2016, 04:40 PM
Hello Viktoria,

Please take a look at this Telerik Dojo illustrating how to create  Kendo Grids with the ids of tables.

Note: I set gridArray to the class ".grid" as shown in this here:
var gridArray = $(".grid");
      for (var i = 0; i < gridArray.length; i++) {
            var tmp = gridArray[i];
            var numb = tmp.getAttribute('id');
            $("#" + numb).kendoGrid();
        }

For more information, we have a great sample which demonstrates a Kendo Grid initialized from a table, and here is our helpful documentation detailing more about the subject (just scroll down a little to the "From HTML Table" section).

Hopefully, this helps clear things.

Regards,
Patrick
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
Viktoria
Top achievements
Rank 1
Answers by
Patrick | Technical Support Engineer, Senior
Telerik team
Share this question
or