-
3 Jan 2012 7:32 AM #1
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.
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, //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(); }
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(); }
-
3 Jan 2012 7:50 AM #2Sencha - Senior Forum Manager
- Join Date
- Mar 2007
- Location
- St. Louis, MO
- Posts
- 33,714
- Vote Rating
- 438
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.
Wait! Looks like we don't have enough information to add this to bug database. Please follow this template bug format.


Reply With Quote