tree.setChildCalcMode("leafsrec")

Hi,

         I am very new person for this one. I have a doubt regarding retrieving the child item count.
I could not get the count of items. I have tried all combination of modes, but i am getting “undefined” value.

I am using like tree.setChildCalcMode(“leafsrec”);  or  tree.setChildCalcMode(“child”);

Kindly help me.

Regards,
Suba Paul


Hello,


This issue can be caused by using setChildCalcHTML. This method requires the left and right html templates as the parameters. If you just set tree.setChildCalcHTML(""), the described issue occurs.


The example of correct usage is:


tree.setChildCalcMode(“leafsrec”);
tree.setChildCalcHTML("(",")");


If the issue still isn’t resolved, please provide any sample to reproduce the problem.






Hi Alex,

         We bought this professional edition. I am using setChildCalcMode only, but i am getting the same error. Herewith i have enclosed the my sample programme. Kindly help me.

Thanks & Regards,
Suba Paul


Hello Subathra,


setChildCalcMode displays the number of child items next to the parent. This method doesn’t return anything.


It should be called before data adding. Please, try to do the following:



tree2.setChildCalcMode(‘child’);
tree2.loadXML(“cgprioritylevel.xml”);


We have removed your attachment - it contained files from PRO edition.




Hi Alex,

         Thanks  a lot. But i want that count while retrieving the data from tree and store it into db. What should i do?

Thanks & Regards,
    Subathra


You can try to use one of the following approaches depending on item count you want to get:


1) hasChildren(itemId) method - returns the number of nearest child nodes ( from the next level):


var count = tree.hasChildren(0) - the number of items on 1st level


2) getAllSubItems(itemId) returns the list of all child items:


var list = tree.getAllSubItems(0);


var arr = list.split(",");


var count = arr.length;