re: dhtml tree duplicate children for the same parent


Hello,



Functionality below worked, thank you.



tree.attachEvent(“onEdit”,function(stage,id,tree,value){
     if (stage==2){ //before editor closed
          var ids=tree.getAllSubItems(0).split(",");
          for (var i=0; i<ids.length; i++)
               if (tree.getItemText(ids[i])==value) return false; //revert to old value if there is a duplicate
    } 
    return true;
})




 



Can we keep focus on the node that was a duplicate and was reverted to old value? So it will be still editable.

There is no way to keep focus, but it possible to refocus on the same action by using

var ids=tree.getAllSubItems(0).split(",");
for (var i=0; i<ids.length; i++)
if (tree.getItemText(ids[i])==value) {
var sid=ids[i];
window.setTimeout(function(){
tree.selecteItem(sid);
tree.editItem(sid);
},1);
return false;
}


 it worked.



Thank you very much for your help