Results 1 to 2 of 2

Thread: bug: TreeNodeUI shouldn't have disabled state

  1. #1
    Ext JS Premium Member
    Join Date
    Sep 2008
    Posts
    5
    Vote Rating
    0
      0  

    Default bug: TreeNodeUI shouldn't have disabled state

    The TreeNodeUI isn't initializing it's disabled state properly. In fact, it doesn't need to have disabled state at all. Another user has also run into the same bug:
    http://extjs.com/forum/showthread.php?t=2548

    To repro the bug, create a new TreeNode and pass in a config object with 'disabled=true'. The tree node will still be selectable and the tree node text won't be greyed out.

    Here is a patch against the ext-2.2 release:

    Code:
    Index: source/widgets/tree/TreeNodeUI.js
    ===================================================================
    --- source/widgets/tree/TreeNodeUI.js
    +++ source/widgets/tree/TreeNodeUI.js
    @@ -55,7 +55,6 @@
     
         // private
         onDisableChange : function(node, state){
    -        this.disabled = state;
     		if (this.checkbox) {
     			this.checkbox.disabled = state;
     		}        
    @@ -135,12 +134,7 @@
         initEvents : function(){
             this.node.on("move", this.onMove, this);
     
    -        if(this.node.disabled){
    -            this.addClass("x-tree-node-disabled");
    -			if (this.checkbox) {
    -				this.checkbox.disabled = true;
    -			}            
    -        }
    +        this.onDisabledChange(this.node, this.node.disabled);
             if(this.node.hidden){
                 this.hide();
             }
    @@ -197,14 +191,14 @@
             }
             if(this.fireEvent("beforeclick", this.node, e) !== false){
                 var a = e.getTarget('a');
    -            if(!this.disabled && this.node.attributes.href && a){
    +            if(!this.node.disabled && this.node.attributes.href && a){
                     this.fireEvent("click", this.node, e);
                     return;
                 }else if(a && e.ctrlKey){
                     e.stopEvent();
                 }
                 e.preventDefault();
    -            if(this.disabled){
    +            if(this.node.disabled){
                     return;
                 }
     
    @@ -221,7 +215,7 @@
         // private
         onDblClick : function(e){
             e.preventDefault();
    -        if(this.disabled){
    +        if(this.node.disabled){
                 return;
             }
             if(this.checkbox){

    I also suggest that 'onOver' check for the node's disabled state before changing to the 'x-tree-node-over' class.

  2. #2
    Sencha - Community Support Team jsakalos's Avatar
    Join Date
    Apr 2007
    Location
    Slovakia
    Posts
    27,664
    Vote Rating
    403
      0  

    Default

    Thank you for info and patch. I'm moving this thread to bugs.
    Jozef Sakalos, aka Saki

    Education, extensions and services for developers at new http://extjs.eu
    News: Grid MultiSearch Plugin, Grid MultiSort Plugin, Configuring ViewModel Hierarchy


Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •