Tree - maximum levels: 23

Hello,



is it possible, that the maximum count of level’s is restricted by 23?



I have build a tree, which iterates at every node. After the 23 depth of hierarchy, the tree finish with rendering.



by the way: is it possible in future to avoid such diabolic circles? Currently it is possible to have a tree like:



root

|-id 1

|- id2

|- id1

… and so on.



i think: the three should not render nodes with id’s, which appears on a higher level.



Best regards,

Stefan




Hello,


>> is it possible, that the maximum count of level’s is restricted by 23?


Yes, it is possible. Tree uses tables to present nodes. The number of embeded tables a is restricted by browser (this number is different for each browser).


>> i think: the three should not render nodes with id’s, which appears on a higher level.


Please, provide more details. How do you add items and how the items with the same ids appear in tree?


Hello Alex,



 



attached is a picture. The Numbers are also the id’s. You can see, that it is possible to build recursive nodes.



From top: the folder 5+192 appears on level 2 and on level 5. It would be nice, if the tree can prohibit this.



Because the tree data are defined in other applications, it is not possible to check such things at this point.



Best regards,



Stefan




But how tree nodes are added ? Are they just loaded from xml (loadXML method) ? or possibly you use refreshing methods.


We need to know that to provide you the solution, as it isn’t possibly to modify tree logic completely.


Hi,



 



i am loading the first level:



 



 

SPAN { font-family: "Arial monospaced for SAP"; font-size: 8pt; color: #000000; background: #FFFFFF; } .L3S32 { color: #7D9EC0; } .L3S33 { color: #009300; }

                   tree = new dhtmlXTreeObject(“treeboxbox_tree”,“80%”,“80%”,0);
                    tree.setImagePath("…/…/libraries/dhtmlx/tree/codebase/imgs/");
                    tree.setIconSize(0,0);
                    tree.enableSmartXMLParsing(true);
                  //tree.enableSmartRendering(true);
                    tree.setXMLAutoLoading(“folders.xml?uname=<%=sy-uname%>”);
                    tree.setOnLoadingStart(func_a);
                    tree.setOnLoadingEnd(func_b);
                    tree.enableTreeLines(“true”);
                    tree.setIconSize(0,0);

                    tree.loadXML(“folders.xml?uname=<%=sy-uname%>”);




 



if the child is set on 1, an expander appears. If the user clicks the expander, a new request is started. For this i create a  new coresponding xml for this node.



Its a  techique from the samples.



 



Best reagrds, Stefan



 



 


Hello,


in this case you can make the following modification in the dhtmlxtree.js:


please locate line 1028:

p.each(“item”,function(c,i){


and plase the following line after it:
if (this._idpull[c.get(“id”)]) return; //can be added




Hi,



 



i can locate the line, but it is not clear where to paste the statement:



That’s the line:



var preNode=0;this.npl=0;p.each(“item”,function(c,i){temp.XMLload=1;if ((this._epgps)&&(this._epgpsC==this.npl)){this._setNextPageSign(temp,this.npl+1*(start||0),level,node);return -1};this._parseItem(c,temp,preNode);if ((this._edsbps)&&(this.npl==this._edsbpsC)){this._distributedStart(p,i+1,parentId,level,temp.childsCount);return -1};this.npl++},this,start);if (!level){p.each(“userdata”,function(u){this.setUserData(p.get(“id”),u.get(“name”),u.content())},this);temp.XMLload=1;if (this.waitUpdateXML){this.waitUpdateXML=false;for (var i=temp.childsCount-1;i>=0;i–)if (temp.childNodes[i]._dmark)this.deleteItem(temp.childNodes[i].id)};var parsedNodeTop=this._globalIdStorageFind(this.parsingOn);for (var i=0;i<this.parsedArray.length;i++)temp.htmlNode.childNodes[0].appendChild(this.parsedArray[i]);this.lastLoadedXMLId=parentId;this.XMLloadingWarning=0;var chArr=this.setCheckList.split(this.dlmtr);for (var n=0;n<chArr.length;n++)if (chArr[n])this.setCheck(chArr[n],1);if ((this.XMLsource)&&(this.tscheck)&&(this.smcheck)&&(temp.id!=this.rootId)){if (temp.checkstate===0)this._setSubChecked(0,temp);else if (temp.checkstate===1)this._setSubChecked(1,temp)};if (this.onXLE)this.onXLE(this,parentId);this._redrawFrom(this,null,start)



 



Should i change to?:



 



var preNode=0;this.npl=0;p.each(“item”,function(c,i){



if (this._idpull[c.get(“id”)]) return; //can be added



 



temp.XMLload=1;if ((this._epgps)&&(this._epgpsC==this.npl)){this._setNextPageSign(temp,this.npl+1*(start||0),level,node);return -1};this._parseItem(c,temp,preNode);if ((this._edsbps)&&(this.npl==this._edsbpsC)){this._distributedStart(p,i+1,parentId,level,temp.childsCount);return -1};this.npl++},this,start);if (!level){p.each(“userdata”,function(u){this.setUserData(p.get(“id”),u.get(“name”),u.content())},this);temp.XMLload=1;if (this.waitUpdateXML){this.waitUpdateXML=false;for (var i=temp.childsCount-1;i>=0;i–)if (temp.childNodes[i]._dmark)this.deleteItem(temp.childNodes[i].id)};var parsedNodeTop=this._globalIdStorageFind(this.parsingOn);for (var i=0;i<this.parsedArray.length;i++)temp.htmlNode.childNodes[0].appendChild(this.parsedArray[i]);this.lastLoadedXMLId=parentId;this.XMLloadingWarning=0;var chArr=this.setCheckList.split(this.dlmtr);for (var n=0;n<chArr.length;n++)if (chArr[n])this.setCheck(chArr[n],1);if ((this.XMLsource)&&(this.tscheck)&&(this.smcheck)&&(temp.id!=this.rootId)){if (temp.checkstate===0)this._setSubChecked(0,temp);else if (temp.checkstate===1)this._setSubChecked(1,temp)};if (this.onXLE)this.onXLE(this,parentId);this._redrawFrom(this,null,start)



 


Hello,


yes, you have found a correct line in a compessed code:


…var preNode=0;this.npl=0;p.each(“item”,function(c,i){if(this._idpull[c.get(“id”)])return;temp.XMLload=1; …


Hi,



if i do this, the tree is not able to load items of the next level: i.e. it does not incorporate items in the next level, which for themself have child.



I have attached picture, which demonstrates this.



 



Best regards, Stefan



 



 


Hello,


you’ve asked to modify code to not allow to add items with ids that are already in tree. Am I right?


If the issue occurs for unigue ids, please provide a link to a problematic page. You can also provide the link to support@dhtmlx.com.


Hello,



not at all. i don’t want to have duplicate id in ‘one’ bracnch (from top to end).



 



Thank you very much,



Stefan



 


Tree can not control ids in this case.


It should be done on server when you generate xml. To make all tree ids unique you can add pass items with combined ids. For example:


parentId_itemId.


In this case ids will be always unique and you will be able to get the original item id by spliting id by divider ("_" in the example).