Edit this page

select

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

Parameters

rows Element |jQuery

A DOM element or jQuery object which represents the table row(s) or cell(s).

Returns

jQuery the selected table rows or cells.

Example - select 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 - get 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);
      console.log(data.name);
    }
  });
</script>
Is this article helpful? Yes / No
Thank you for your feedback!

Give article feedback

Tell us how we can improve this article

close
Dummy