Is there any way to open limited number of levels of tree dynamicaly? I mean tree with dynamical loading… Starting from specified node…
I extended tree object with the following method, which does the job. Try it…
dhtmlXTreeObject.prototype.openLevelsDynamic = function(itemId,depth){ if(!itemId) itemId = this.tmpValueForDynLevelsItemId var tmpAr = this.getAllSubItems(itemId).split(","); tmpAr[tmpAr.length] = itemId; var outAr = new Array(0); for(var i=0;i<tmpAr.length;i++){ if(this.hasChildren(tmpAr[i])===true) outAr[outAr.length] = tmpAr[i] } if(depth){ this.tmpValueForDynLevels = depth-1; this.tmpValueForDynLevelsItemId = itemId||tree.rootId this.attachEvent(“onOpenDynamicEnd”,function(){ if(this.tmpValueForDynLevels>0) this.openLevelsDynamic(); this.tmpValueForDynLevels = this.tmpValueForDynLevels-1; }) } if(outAr.length>0) this.openItemsDynamic(outAr.join(",")); }