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 ?
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?
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 ?
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.
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 ?
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;
})
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