Start Building Professional
Web Apps Today


 
Categories Question details Back To List
Question  posted by n.darques on Mar 27, 2009 01:13
open dhtmlx forum
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. '
( http://dhtmlx.com/docs/products/kb/index.php?s=normal&q=8202&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.
Answer posted by Alex (support) on Mar 27, 2009 07:48

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

Answer posted by n.darques on Mar 27, 2009 08:43
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.



Answer posted by Alex (support) on Mar 30, 2009 06:40

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(/\\[[^\\]]*\\]/,"");