Friday 15 July 2011

how to expand the parent nodes of a selected child node on kendo treeview -



how to expand the parent nodes of a selected child node on kendo treeview -

hi there kendo enthusiast.. have little problem on kendo treeview, manage expand selected kid node of treeview if parent, can expand it's grand parents, here little code:

data.foreach(function (entry) { var treeview = $("#sysfunc_ktreeview").data('kendotreeview'); var datasource = treeview.datasource; var dataitem = datasource.get(entry); var node = treeview.findbyuid(dataitem.uid); var checkbox = $("input[type='checkbox']", node)[0]; checkbox.click(); });

in case getting array database. here, cant expand parent nodes if there kid nodes checked there id(the parent) not in array. great help much appreciated. little piece of code sir onabai.. sir

if want click ancestors of items id in data, add together next lines of code:

var ancestors = $(node).parents("li[role='treeitem']"); $(">div>span>input", ancestors).click();

this selects ancestors of current node each of them clicks input.

so code should like:

data.foreach(function (entry) { var treeview = $("#treeview").data('kendotreeview'); var datasource = treeview.datasource; var dataitem = datasource.get(entry); var node = treeview.findbyuid(dataitem.uid); var checkbox = $("input[type='checkbox']", node)[0]; checkbox.click(); var ancestors = $(node).parents("li[role='treeitem']"); $(">div>span>input", ancestors).click(); });

you can see running here: http://dojo.telerik.com/@onabai/irom

kendo-ui kendo-asp.net-mvc kendo-treeview

No comments:

Post a Comment