Grid dataItem() function - eq(1) is John not Jane

3 posts, 0 answers
  1. Chris
    Chris avatar
    121 posts
    Member since:
    Oct 2015

    Posted 21 Feb 2017 Link to this post

    HI

    The wrong description in online document.

    jquery eq(index), the index is 0-based, so the comment 'displays "Jane Doe"' was WRONG : 

    dataItem
    http://docs.telerik.com/kendo-ui/api/javascript/ui/grid#methods-dataItem

    EXAMPLE - GET THE DATA ITEM TO WHICH THE FIRST TABLE ROW IS BOUND

    $("#grid").kendoGrid({
      columns: [
        { field: "name" },
        { field: "age" }
      ],
      dataSource: [
          { name: "Jane Doe", age: 30 },
          { name: "John Doe", age: 33 }
      ]
    });
    var grid = $("#grid").data("kendoGrid");
    var data = grid.dataItem("tr:eq(1)");
    console.log(data.name); // displays "Jane Doe"  <-------------------- the comment was WRONG

    Best regards

    Chris

     


  2. Chris
    Chris avatar
    121 posts
    Member since:
    Oct 2015

    Posted 21 Feb 2017 in reply to Chris Link to this post

    kendo.ui.Grid > dataItem method

    http://docs.telerik.com/kendo-ui/api/javascript/ui/grid#methods-dataItem

     

  3. Alex Hajigeorgieva
    Admin
    Alex Hajigeorgieva avatar
    1082 posts

    Posted 23 Feb 2017 Link to this post

    Hi Chris,

    Thank you for taking the time to comment on the example in the Kendo UI Grid. 

    We described the selection from a visual perspective, that is the first row. The demo actually can be improved by changing the selector, because ("tr:eq(0)") will get the table headers. Instead, it is better to target the ("tbody:eq(0)"). 

    var data = grid.dataItem("tbody tr:eq(0)");

    If you have seen anything else which you feel should be different, please be advised that contribution to our public documentation is always welcome, here is how:

    https://github.com/telerik/kendo-ui-core/tree/master/docs#contribution

    As for the demo and changing the documentation, I will have it fixed by tomorrow or beginning of next week.

    Kind Regards,
    Alex Hajigeorgieva
    Telerik by Progress
    Try our brand new, jQuery-free Angular 2 components built from ground-up which deliver the business app essential building blocks - a grid component, data visualization (charts) and form elements.
Back to Top