Results 1 to 2 of 2

Thread: MessageBox onClick refers to non-existent button.itemId and button.text

    Wait! Looks like we don't have enough information to add this to bug database. Please follow this template bug format.
  1. #1
    Sencha User
    Join Date
    Jan 2012
    Posts
    7
    Vote Rating
    0
      0  

    Default MessageBox onClick refers to non-existent button.itemId and button.text

    The onClick method for MessageBox does not properly retrieve the itemId or text of a button that are needed as the first parameter when calling the callback method. Specifically, the existing code (below) attempts to use button.itemId and button.text, both of which are non-existent.

    Code:
    onClick: function(button) {
            if (button) {
                var config = button.userConfig || {};
    
    
    
    
                if (typeof config.fn == 'function') {
                    config.fn.call(
                        config.scope || null,
                      //Fixing this sencha bug until sencha address it. The next line previously referred to button.itemId
                      //and button.text, both of which do not exist (the real fields are private ones _itemId, and _text).
                        button.itemId || button.text,
                        config.input ? config.input.dom.value : null,
                        config
                    );
                }
    
    
    
    
                if (config.cls) {
                        this.el.removeCls(config.cls);
                    }
    
    
    
    
                if (config.input) {
                    config.input.dom.blur();
                }
            }
    
    
    
    
            this.hide();
        }
    The fix should be to refer to the getters (or, less ideally, the properly named private fields):

    Code:
        onClick: function(button) {
            if (button) {
                var config = button.userConfig || {};
    
    
    
    
                if (typeof config.fn == 'function') {
                    config.fn.call(
                        config.scope || null,
                        button.getItemId() || button.getText(),
                        config.input ? config.input.dom.value : null,
                        config
                    );
                }
    
    
    
    
                if (config.cls) {
                        this.el.removeCls(config.cls);
                    }
    
    
    
    
                if (config.input) {
                    config.input.dom.blur();
                }
            }
    
    
    
    
            this.hide();
        }

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

    Default

    In PR3, this works as expected:

    Code:
    Ext.Msg.confirm('Test', 'Test', function(btn) {
        console.log(btn);
    });
    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

Tags for this Thread

Posting Permissions

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