Skip to content

Commit 688c14c

Browse files
committed
Add example for expanding row by known ID
1 parent 65ad593 commit 688c14c

File tree

1 file changed

+22
-0
lines changed

1 file changed

+22
-0
lines changed

api/javascript/ui/treelist.md

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2851,6 +2851,28 @@ This method expands the row.
28512851
treeList.expand($("#treeList tbody>tr:eq(0)"));
28522852
</script>
28532853

2854+
#### Example - expand row of a data item with a given id
2855+
2856+
<div id="treeList"></div>
2857+
<script>
2858+
$("#treeList").kendoTreeList({
2859+
columns: [ "id", "name" ],
2860+
dataSource: [
2861+
{ id: 1, parentId: null, name: "Jane Doe", age: 30 },
2862+
{ id: 2, parentId: 1, name: "John Doe", age: 33 }
2863+
]
2864+
});
2865+
var treeList = $("#treeList").data("kendoTreeList");
2866+
2867+
// find item with id = 1 in datasource
2868+
var dataItem = treeList.dataSource.get(1);
2869+
2870+
// find row for data item
2871+
var row = treeList.content.find("tr[data-uid=" + dataItem.uid + "]")
2872+
2873+
treeList.expand(row);
2874+
</script>
2875+
28542876
### refresh
28552877

28562878
Renders all table rows using the current data items.

0 commit comments

Comments
 (0)