dhtmlxTree ChildCalculation

When editing a node in a tree that have child calculation on, value transmitted at stage 0 is not properly stripped ( ‘blablalbla [x]’ instead of ‘blablalbla’).



From a more general view, I agree with this post :

'It seems to me that the best way to handle this is to change the internal structure of the tree and display this information in a field next to the node label. This solution could be generalized to allow us to display userdata for each node, as well. ’

( dhtmlx.com/docs/products/kb/inde … 02&a=13781)



Child calculation is a ‘pain in the …’ from first time it has been introduced in dhtmlxTree.

Furthermore, it is an ‘allways asked feature’ by user.

A more robust approach would be a relief.


In the latest tree version a child calc number isn’t shown when you edit an item.

That’s right. But I’m not talking about value you when editing but value you get from onEdit at stage 0.

In the current version I’m using (2.1 build 90226) :
- value parameter ‘onEdit’ event at stage 0 contains  child calculation string part.
- with full serialization, item tree text contains child calculation string part.
- tree.getItemText(itemId) returns a string that contains child calculation string part.




Unfortunately, currently the described features can not be changed. But you can apply additional techniques to get the item text without cal number.


In case of serialization:


tree.setChildCalcMode(“child”);


tree.registerXMLEntity("\[[^\]]\]","");

tree.setSerializationLevel(false,false,true); /the 3rd parameter should be true/


For “onEdit” value and text, which is returned by getItemText, you can apply the same replacement as presented above:



value = value.replace(/\[[^\]]
\]/,"");