View Full Version : Error Message: Ext.Msg is undefined

Manoj Wadhwa
30 Nov 2011, 5:08 AM
I am unable to use Ext.Msg inside the controller class. Tried out adding requires : ['Ext.Window.MessageBox'] but still doesn't work. I'm just starting off to use Extjs 4.0. Please let me know what am I missing

Ext.define('Ads.controller.LeftMenu', {
extend: 'Ext.app.Controller',
//requires: ['Ext.Window.MessageBox'],
views: ['Viewport'],
init: function() {
console.log('LeftMenu init called');
'menu': {
click: this.onLeftMenuClick

onLeftMenuClick : function( menu, item, eventObj, eOpts ){
//Ext.Msg.alert(item.text, item.text);
Ext.Msg.alert('Hello', 'Hello');

30 Nov 2011, 9:08 AM
requires: ['Ext.Window.MessageBox']

should be

requires: ['Ext.window.MessageBox']

Ext.Window is wrong, Ext.window is correct.

30 Nov 2011, 11:46 PM
I don't think you actually need to specifically write the requires: config. I can create messageBoxes without it.

Is your ComponentQuery for that "menu" item correct? Are u correctly referring to it ? Maybe you're not referring it correctly, that's why when u click it its not alerting anything. (because the control is not registered)

Try a simple thing first:

onLeftMenuClick : function(){
alert ("Hahahaha!");

If u see the alert then your componentquery is correct...

1 Dec 2011, 5:30 AM
You do need it as it's not in ext.js. Some other classes may require it that you are using. Ext.Msg won't be created until it Ext.window.MessageBox is dynamically loaded.