Add grid to tables

2 posts, 0 answers
  1. Viktoria
    Viktoria avatar
    1 posts
    Member since:
    Feb 2016

    Posted 10 Feb 2016 Link to this post

    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?

  2. Patrick
    Admin
    Patrick avatar
    251 posts

    Posted 11 Feb 2016 Link to this post

    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!
     
Back to Top