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

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

2 Answers 296 Views
Grid
This is a migrated thread and some comments may be shown as answers.
Chris
Top achievements
Rank 1
Veteran
Iron
Iron
Chris asked on 22 Feb 2017, 05:39 AM

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 Answers, 1 is accepted

Sort by
0
Chris
Top achievements
Rank 1
Veteran
Iron
Iron
answered on 22 Feb 2017, 05:41 AM

kendo.ui.Grid > dataItem method

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

 

0
Alex Hajigeorgieva
Telerik team
answered on 23 Feb 2017, 04:16 PM
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 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 (charts) and form elements.
Tags
Grid
Asked by
Chris
Top achievements
Rank 1
Veteran
Iron
Iron
Answers by
Chris
Top achievements
Rank 1
Veteran
Iron
Iron
Alex Hajigeorgieva
Telerik team
Share this question
or