1. #1
    Ext User
    Join Date
    Mar 2007
    Posts
    5
    Vote Rating
    0
    yui-ext is cool is on a distinguished road

      0  

    Default ToolbarButton.disabled

    ToolbarButton.disabled


    It appears that disabling toolbar buttons is not working in .33 RC1

    in YAHOO.ext.ToolbarButton.prototype, it appears that this.el is being reset to nothing somewhere. Additionally, once you get to the mouseover event, this.disabled property is being reset to false as well.

    To reproduce:
    Code:
    var toolBar =
    {
    	init : function()
    	{
    		 this.toolBar = new YAHOO.ext.Toolbar('divToolbar');
    		 this.btnSave = new YAHOO.ext.ToolbarButton({text: 'Save', tooltip: 'Save Image', className: 'toolBarButtonSave'});
    		 this.toolBar.addButton(this.btnSave);
    		 this.btnSave.disable();
    		 
    	}
    }
    after calling toolBar.init(); The toolbar is built and renders correctly, but the button does not appear disabled and the mouseover, click etc events are still triggered.

    if you check the value of toolBar.btnSave.isDisabled() after rendering, it returns true.

    if you check the value of this.el in the disable function, it returns undefined.

    if you check the value in the mouseover event, this.disabled = false;

    I'm kind of stumped on this one.

  2. #2
    Sencha User jack.slocum's Avatar
    Join Date
    Mar 2007
    Location
    Tampa, FL
    Posts
    6,955
    Vote Rating
    16
    jack.slocum will become famous soon enough

      0  

    Default


    The problem is addButton takes a button config, not an actual button. There are two ways to do the same as you are doing:

    Code:
    this.toolBar = new YAHOO.ext.Toolbar('divToolbar');
    this.btnSave = this.toolBar.addButton({text: 'Save', tooltip: 'Save Image', className: 'toolBarButtonSave'});
    this.btnSave.disable();
    or:

    Code:
    this.toolBar = new YAHOO.ext.Toolbar('divToolbar');
    this.btnSave = new YAHOO.ext.ToolbarButton({text: 'Save', tooltip: 'Save Image', className: 'toolBarButtonSave'});
    this.toolBar.add(this.btnSave);
    this.btnSave.disable();
    Since this may be a common thing, I did change the dev code so if you pass a ToolbarButton to addButton it will just defer to add().

  3. #3
    Ext User
    Join Date
    Mar 2007
    Posts
    5
    Vote Rating
    0
    yui-ext is cool is on a distinguished road

      0  

    Default


    Thanks Jack, that did the trick.

Similar Threads

  1. min includes for DateField & disabled dates
    By VinylFox in forum Ext 2.x: Help & Discussion
    Replies: 4
    Last Post: 17 Apr 2007, 1:48 AM
  2. ToolbarButton config disabled
    By Condor70 in forum Ext 1.x: Bugs
    Replies: 1
    Last Post: 2 Feb 2007, 4:06 PM
  3. Replies: 1
    Last Post: 13 Dec 2006, 6:05 AM
  4. Toolbarbutton className
    By alex1er in forum Ext 1.x: Help & Discussion
    Replies: 2
    Last Post: 16 Nov 2006, 6:27 AM

Thread Participants: 1