I’m trying to turn on item editor only on second click, because I need a different behaviour on double click.
So, I set tree.setEditStartAction(true, false); but the handler still gets called on double click and the double click handler is ignored.
Am I doing something wrong, or is there a very obvious bug here?
Editing on double click can not be disabled if click on a selected item opens an editor. Double click fires two click events: the first selects item, the second opens editor.
You may use the following workaround:
enable Editing
disable editing on click and double click
set own onClick event handler that will call editItem method when it is needed.
Here is the example:
tree.enableItemEditor(true);
tree.setEditStartAction(false,false);
var selected, selectTime;
var dblDelay = 400;
var editDelay = 1500;
tree.attachEvent("onClick",function(id){
var diff;
if(selected&&selected==id){
diff = (new Date()).getTime()-selectTime;
if(diff<dblDelay){
alert("double click action");
}
else if(diff<editDelay){
tree.editItem(id);
}
}
selectTime = (new Date()).getTime();
selected = id;
});
This approach of detecting double click does not seem to work in IE9.
I did some testing and it seems the second click does not fire the onClick event in IE9.