Skip to content
Desislava Mihaylova edited this page May 2, 2016 · 2 revisions

The Methods section shows the methods of a widget or component.

Document the parameters, return value, and examples in that order.

EXAMPLE

### dataItem

Returns the data item to which the specified table row is bound.

#### Parameters

##### row `String|Element|jQuery`

A string, DOM element or jQuery object which represents the table row. A string is treated as a jQuery selector.

##### index `Number` *(optional)*

A zero-based index of the data record. Illustrates the documentation of optional parameters.

#### Returns

`kendo.data.ObservableObject` the data item to which the specified table row is bound.

#### Example - get the data item to which the first table row is bound

    <div id="grid"></div>
    <script>
    $("#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"
    </script>

The example is defined in a #### section.

The method parameters are specified similar to the configuration options. However, they are defined in ##### sections.

The result of the method is specified in the #### Returns section. Its description must begin with a code block showing the type of the result, which is required for code generation.