select

Gets or sets the table rows (or cells) which are selected.

Parameters

rows Element|jQuery

A DOM element or a jQuery object which represents the table rows or cells.

Returns

jQuery - The selected table rows or cells.

Example - selecting the first table cell

<button id="btn">Highlight third row</button>
<div id="treeList"></div>
<script>
  $("#treeList").kendoTreeList({
    columns: [
      { field: "id" },
      { field: "name" },
      { field: "age" }
    ],
    dataSource: [
      { id: 1, parentId: null, name: "Jane Doe", age: 22, expanded: true },
      { id: 2, parentId: 1, name: "John Doe", age: 24 },
      { id: 3, parentId: 1, name: "Jenny Doe", age: 3 }
    ],
    selectable: true
  });
  $("#btn").click(function(){
    var treeList = $("#treeList").data("kendoTreeList");

    treeList.select($("#treeList tbody>tr:nth(2)"));
  });
</script>

Example - getting the selected table row

<button id="btn">Get selected row info</button>
<div id="treeList"></div>
<script>
  $("#treeList").kendoTreeList({
    columns: [
      { field: "id" },
      { field: "name" },
      { field: "age" }
    ],
    dataSource: [
      { id: 1, parentId: null, name: "Jane Doe", age: 22, expanded: true },
      { id: 2, parentId: 1, name: "John Doe", age: 24 },
      { id: 3, parentId: 1, name: "Jenny Doe", age: 3 }
    ],
    selectable: true
  });
  $("#btn").click(function(){
    var treeList = $("#treeList").data("kendoTreeList");
    var row = treeList.select();
    if(row.length > 0){
      var data = treeList.dataItem(row);
/* The result can be observed in the DevTools(F12) console of the browser. */
      console.log(data.name);
    }
  });
</script>

Example - getting the selected table row when checkbox selection is enabled

Get selected row/rows

In this article