PDA

View Full Version : Disabled tree node is selected on click



dbadke
23 Feb 2007, 11:06 AM
When a tree node is set to disabled, it should not be selected when it is clicked on. There is a bug in TreeNodeUI.js that allows it to be selected. The bug appears to be in the latest 1.0-alpha release, as well as in .40.

In the TreeNodeUI object:


onClick : function(e){
if(this.dropping){
return;
}
if(this.fireEvent('beforeclick', this.node, e) !== false){
if(!this.disabled && this.node.attributes.href) <-------------------
this.focus();
this.fireEvent('click', this.node, e);
return;
}
e.preventDefault();
if(this.disabled){ <---------------------
return;
}
this.focus();
this.fireEvent('click', this.node, e);
}else{
e.stopEvent();
}
},

onDblClick : function(e){
e.preventDefault();
if(this.disabled){ <--------------------------------
return;
}
if(!this.animating && this.node.hasChildNodes()){
this.node.toggle();
}
this.fireEvent('dblclick', this.node, e);
},


At the marked lines (<-------) it is testing for this.disabled. At that point, this is the node object (wrapper?), which has no disabled property, not the node itself, which does. I believe the marked lines should be testing for this.node.disabled.

I changed my local copy of the source in this way, and disabled nodes can no longer be selected.