Class('App', 'xui.Com',{ Instance:{ iniComponents : function(){ // [[Code created by CrossUI RAD Tools var host=this, children=[], append=function(child){children.push(child.get(0))}; append( (new xui.UI.Block) .setHost(host,"ctl_pane6") .setLeft(30) .setTop(40) .setWidth(270) .setHeight(220) .setBorderType("inset") ); host.ctl_pane6.append( (new xui.UI.TreeView) .setHost(host,"ctl_treebar3") .setItems([{"id":"node1", "sub":["node11", {"id":"node12", "image":"img/demo.gif", "sub":["1", "2", "3"]}, "node13", "node14"], "caption":"node1"}, {"id":"node2", "sub":["node21", "node22", "node23", "node24"], "caption":"node2"}]) ); append( (new xui.UI.SButton) .setHost(host,"ctl_sbutton5") .setLeft(50) .setTop(10) .setWidth(100) .setCaption("Expand All") .onClick("_ctl_sbutton5_onclick") ); append( (new xui.UI.SButton) .setHost(host,"ctl_sbutton15") .setLeft(170) .setTop(10) .setWidth(100) .setCaption("Fold All") .onClick("_ctl_sbutton15_onclick") ); return children; // ]]Code created by CrossUI RAD Tools }, _ctl_sbutton5_onclick : function (profile, e, src, value){ this.ctl_treebar3.toggleNode("",true,true); }, _ctl_sbutton15_onclick : function (profile, e, src, value){ this.ctl_treebar3.toggleNode("",false,true); } } });
How to expand/fold all nodes in TreeView?
How to expand/fold all nodes in TreeView?
The followsing code needs xui revision >= 23: