Start Building Professional
Web Apps Today


 
Categories Question details Back To List
Question  posted by n.darques on Feb 27, 2009 00:42
open dhtmlx forum
dhtmlxTree Cancel closing edit (state 2) not working

Hello Guys,

When I'm setting an "onEdit" event function for a dhmlxTree which return a false value on state 2, it doesn't properly cancel closing editor.

Example code :

tree.attachEvent("onEdit",treeOnEdit);

function treeOnEdit(state,selectedItems,tree,value) {
    switch(state) {
        case 2:
return false;
        break;
            
        
    }
return true;
}

It's quite annoying, any quick fix ?
Answer posted by Support on Feb 27, 2009 03:32
What do you mean by " it doesn't properly cancel closing editor."
 Returning false from event handler will cause value reverting to initial one. Is it works differently in your case?
Answer posted by n.darques on Feb 27, 2009 03:55
As it's said in the documentation :
state - 0 before editing started , 1 after editing started, 2 before closing, 3 after closed
Returns:for stages 0 and 2; true - confirm opening/closing, false - deny opening/closing;

I was expecting that the closing event was cancelled, that is to say, editor still active and waiting for correcting input.
If it not designed like this, how could I reproduce this behaviour ?

Answer posted by Alex (support) on Feb 27, 2009 06:30

The issue is fixed. It will be available in the next tree version (in few days). 

You can contact us at support@dhtmlx.com and we will send you the fixed version. 

Answer posted by n.darques on Mar 27, 2009 00:58
Latest version (2.1 90226) of dhtmlx tree doesn't fixed this issue.
Returning false at Stage 2 stills close the editor and goes back to old value.

Any thought ?
Answer posted by Alex (support) on Mar 27, 2009 07:05

Sorry for teh misleading infomation. There was another issue with returning false in stage 2 and it was fixed.

Unfortunately, there are no ways to stop editor closing. 

But you can open the editor again if the result is not correct. For example:

tree.atatchEvent("onEdit,function(stage,id,treeObj,val){
  if(stage==3 &&!checkResult(val)) tree.editItem(id);
  return true;
})

Answer posted by Subathra on May 06, 2009 01:38
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