I am using kendo ui treeview widget control. I am dynamically getting the parents and child. How can i expand all the parents and child. I have wrote code:
var treeview = $('#tree').kendoTreeView({
dataSource: parent,
dataTextField: ["question", "answer", "parentvalue"]
});
treeview.expand('.k-item');
but it is not working. How can i do that.
If you are using remote dataSource you will have no luck expanding it in such way because the items are still not loaded and created.
Instead use the dataBound event of the TreeView and set the loadOnDemand property to false (so all the items are loaded initially then try to expand the items (you might need to do it recursevely) .