Reputation: 159
Kendo has added a new API method called expandPath
to its treeView in Q3 2013. Unfortunately I can't find any documentation about it in Kendo UI Docs or its forums.
Has anybody used this method? A sample would be great.
Upvotes: 4
Views: 1559
Reputation: 18402
Well, it lets you expand a path and provide a callback that is called once all nodes are expanded:
var tree = $("#treeview").kendoTreeView({
dataSource: [{
id: 0,
text: "Furniture",
items: [{
id: 1,
text: "Tables & Chairs"
}, {
id: 2,
text: "Sofas"
}, {
id: 3,
text: "Occasional Furniture",
items: [{
id: 8,
text: "Small Sofas"
}, {
id: 9,
text: "Tiny Sofas",
items: [{
id: 10,
text: "Small Tiny Sofas"
}, {
id: 11,
text: "Smallest Tiny Sofas"
}]
}]
}]
}, {
id: 4,
text: "Decor",
items: [{
id: 5,
text: "Bed Linen"
}, {
id: 6,
text: "Curtains & Blinds"
}, {
id: 7,
text: "Carpets"
}]
}]
}).data().kendoTreeView;
tree.expandPath([0, 3, 9], function() {
console.log("hello");
});
The first parameter is an array of node ids describing the path (in the order you would expand them manually). The second parameter is a callback (this parameter is optional) which is probably mainly useful when additional nodes are loaded from a server (the callback doesn't seem to get called if the last node in the array is a leaf node though).
(see demo)
Upvotes: 2