Success! Looks like we've fixed this one. According to our records the fix was applied for TOUCH-3803 in a recent build.
  1. #1
    Sencha User benwhite's Avatar
    Join Date
    Oct 2010
    Location
    Columbus, OH
    Posts
    49
    Vote Rating
    0
    benwhite is on a distinguished road

      0  

    Default Ext.Button#updateIconCls Fails After Unset

    Ext.Button#updateIconCls Fails After Unset


    If you create a button with an iconCls, when you update it to null or '', the icon element never has the original iconCls removed.
    So if you try to set it again, there will be 2 iconCls values applied to the HTML element, and whichever icon takes precedent in the CSS will be the icon displayed to the end user.

    In short, you can't change the iconCls from icon1 --> null --> icon2 for a button.

    Current Code [2.1]
    Code:
                updateIconCls: function (iconCls, oldIconCls) {
                    var me = this,
                        element = me.iconElement;
    
    
                    if (iconCls) {
                        me.showIconElement();
                        element.replaceCls(oldIconCls, iconCls);
                        me.refreshIconAlign();
                        me.refreshIconMask();
                    } else {
                        me.hideIconElement();
                        me.setIconAlign(false);
                    }
                },
    My Fix
    Code:
                updateIconCls: function (iconCls, oldIconCls) {
                    var me = this,
                        element = me.iconElement;
    
    
                    if (iconCls) {
                        me.showIconElement();
                        element.replaceCls(oldIconCls, iconCls);
                        me.refreshIconAlign();
                        me.refreshIconMask();
                    } else {
                        element.removeCls(oldIconCls); //<-- added this line
                        me.hideIconElement();
                        me.setIconAlign(false);
                    }
                },
    I believe this is also true for updateIcon as well, but I have not tested that...

  2. #2
    Sencha - Senior Forum Manager mitchellsimoens's Avatar
    Join Date
    Mar 2007
    Location
    Gainesville, FL
    Posts
    37,327
    Vote Rating
    851
    mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute

      0  

    Default


    Thanks for the report! I have opened a bug in our bug tracker.

Thread Participants: 1