Results 1 to 3 of 3

Thread: Button.setIconCls - doesn't check if icon class changed

    Success! Looks like we've fixed this one. According to our records the fix was applied for EXTJS-7342 in 4.1.4.
  1. #1
    Sencha Premium User
    Join Date
    Nov 2010
    Location
    Chicago
    Posts
    1,932
    Vote Rating
    548
      0  

    Default Button.setIconCls - doesn't check if icon class changed

    The Button.setIconCls method does not check if the class actually changed before resetting the value.

    Is this intentional?

    Code:
    Ext.define('Ext.button.Button', {
        ...
        setIconCls: function(cls) {
            var me = this,
                btnIconEl = me.btnIconEl,
                oldCls = me.iconCls;
                
            me.iconCls = cls;
            if (btnIconEl) {
                // Remove the previous iconCls from the button
                btnIconEl.removeCls(oldCls);
                btnIconEl.addCls(cls || '');
                me.setComponentCls();
                if (me.didIconStateChange(oldCls, cls)) {
                    me.updateLayout();
                }
            }
            return me;
        },
        ....

  2. #2
    Sencha - Sr Software Engineer mitchellsimoens's Avatar
    Join Date
    Mar 2007
    Location
    Gainesville, FL
    Posts
    39,553
    Vote Rating
    1272
      0  

    Default

    I think it can do a simple if statement to check to stop it if it doesn't need to. We will discuss this internally, opening a bug for it.
    Mitchell Simoens @LikelyMitch
    Sencha Inc, Senior Software Engineer
    ________________
    Learn BBCode and use it! Checkout the CODE tag!

    Check out my GitHub, lots of nice things for Ext JS and Sencha Touch
    https://github.com/mitchellsimoens

  3. #3
    Sencha - Ext JS Dev Team evant's Avatar
    Join Date
    Apr 2007
    Location
    Sydney, Australia
    Posts
    18,587
    Vote Rating
    873
      0  

    Default

    The didStateChange checks: Did we go from having no icon to having an icon or vice versa.

    But yes, we could probably add in a check there, not really a bug though.
    Evan Trimboli
    Twitter - @evantrimboli

Posting Permissions

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