PDA

View Full Version : Problem with node double-click



funwithextjs
3 Dec 2010, 11:58 AM
Hi, My requirement is when i click on a node, node should be editable instead of expand/collapse. Ext.override(Ext.tree.TreeEditor, { beforeNodeClick : Ext.emptyFn, onNodeDblClick : function(node, e) { e.stopEvent(); this.triggerEdit(node); } }); Ext.override(Ext.tree.TreeNodeUI, { onDblClick: Ext.emptyFn }); I placed the above code, which prevents node expand/collapse, but the node is not getting in to edit mode. Please help... Thanks

Condor
4 Dec 2010, 1:17 AM
You also have to set the editDelay of the TreeEditor to a lower value than 350ms.

funwithextjs
6 Dec 2010, 8:12 PM
Condor... That did not work... I set editDelay:100 but still node is not editing...

Condor
7 Dec 2010, 12:25 AM
Try:

Ext.override(Ext.tree.TreeNodeUI, {
onDblClick : function(e){
e.preventDefault();
if(this.disabled){
return;
}
if(this.fireEvent("beforedblclick", this.node, e) !== false){
/*if(this.checkbox){
this.toggleCheck();
}
if(!this.animating && this.node.isExpandable()){
this.node.toggle();
}*/
this.fireEvent("dblclick", this.node, e);
}
}
});
Ext.override(Ext.tree.TreeEditor, {
editDelay : 1,
initEditor : function(tree){
tree.on({
scope : this,
//beforeclick: this.beforeNodeClick,
dblclick : /*this.onNodeDblClick*/ this.triggerEdit
});
this.on({
scope : this,
complete : this.updateNode,
beforestartedit: this.fitToTree,
specialkey : this.onSpecialKey
});
this.on('startedit', this.bindScroll, this, {delay:10});
}
});
Disclaimer: Completely untested code.

funwithextjs
7 Dec 2010, 8:13 AM
Its not working when i double click on the node, but when i click on the node, pause and click on the same node. Please help me...

funwithextjs
8 Dec 2010, 7:08 AM
Please any help with this...