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
    3
    Vote Rating
    0
    jamatz is on a distinguished road

      0  

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

    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 - Senior Forum Manager mitchellsimoens's Avatar
    Join Date
    Mar 2007
    Location
    St. Louis, MO
    Posts
    33,714
    Vote Rating
    438
    mitchellsimoens has much to be proud of mitchellsimoens has much to be proud of mitchellsimoens has much to be proud of mitchellsimoens has much to be proud of mitchellsimoens has much to be proud of mitchellsimoens has much to be proud of mitchellsimoens has much to be proud of mitchellsimoens has much to be proud of mitchellsimoens has much to be proud of

      0  

    Default


    In PR3, this works as expected:

    Code:
    Ext.Msg.confirm('Test', 'Test', function(btn) {
        console.log(btn);
    });
    Mitchell Simoens @SenchaMitch
    Sencha Inc, Senior Forum Manager
    ________________
    http://www.JSONPLint.com - Source to lint your JSONP!

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

    Think my support is good? Get more personalized support via a support subscription. https://www.sencha.com/store/

    Need more help with your app? Hire Sencha Services services@sencha.com

    Want to learn Sencha Touch 2? Check out Sencha Touch in Action that is almost in print!

    When posting code, please use BBCode's CODE tags.