PDA

View Full Version : Change Tree and Treeeditor behaviour



steffenk
19 Nov 2010, 4:14 AM
Hi,

As i have a tree where an action is fired on click i have problems with the behaviour and like to change.

Current behaviour:
* Doubleclick selects a node and start edit
* Singleclick on selected node starts edit

Wanted behaviour:
* Doubleclick don't select node but start edit
* Singleclick on selected don't start edit

My try for the tree in listeners:

click: {
fn: function (node, event) {
if (this.doubleClickEventActive) {
this.doubleClickEventActive = false;
event.stopEvent();
} else {
TYPO3.Components.PageTree.PageActions.singleClick(node);
}
},
delay: 400
},

// seems to prevent some internal issues with the double-click for the tree editor
dblclick: {
fn: function() {
this.doubleClickEventActive = true;
return false;
}
}

the problem is that i can't prevent the selection, and editor only edit if node is selected.
Mainly the first is a problem, i found out how to change the second. Any suggestions?

steffenk
19 Nov 2010, 8:28 AM
i tried to catch the select in tree initComponent:


this.selModel = new Ext.tree.DefaultSelectionModel({
onNodeClick : function(node, e){
console.log(this.tree);
if (this.tree.doubleClickEventActive) {
this.tree.doubleClickEventActive = false;
} else {
this.select(node);
}
}
});
but when i doubleclick this happens too late, it's called twice: first before dblclick, seconf after dobleclick where the node is already selected. Difficult to get the correct event queue ...