I have a couple of TreeViews on a razor page, one of which has at least 10 levels.
I need to be able to expand, collapse, and search each of the trees.
I found the following on the forums that supposedly expands the TreeView and it does work - kind of:
http://www.telerik.com/forums/is-there-a-way-to-expand-all-nodes-in-multiple-level-for-treeview#Of6kvLQLNE-YgOdLSPjUlA
It says, "Create a button for it and add event onclick like below (b is counter of not expand node):"
$("#expandAllNodes").click(function (e) {
e.preventDefault();
expandNextLevel();
});
function expandNextLevel() {
setTimeout(function () {
var treeview = $("#treeview").data("kendoTreeView");
var b = $('.k-item .k-plus').length;
treeview.expand(".k-item");
treeview.trigger('dataBound');
if (b > 0) {
expandNextLevel();
}
}, 200);
}
Is always hit, because, at least in my case, the value of b is never less than 4.
So I need some comparison that will tell me that the tree has been completely examined and then it will stop.
Does anyone know how I can do that?
TIA,
Bob Mathis