2012-07-09 121 views
1

我目前正在从书中学习Sencha Touch。下面的例子不工作对我来说:Ext.MessageBox.show()不显示消息

Ext.require('Ext.data.Store'); 
Ext.require('Ext.dataview.List'); 
Ext.require('Ext.MessageBox'); 
new Ext.application({ 
    name: 'TouchStart', 
    launch: function() { 
    this.viewport = new Ext.Panel ({ 
     fullscreen: true, 
     items: [{ 
     docked: 'top', 
     xtype: 'toolbar', 
     ui: 'light', 
     items: [{ 
      text: 'Panic', 
      handler: function(){ 
      Ext.Msg.alert('Don\'t Panic!','Keep calm'); 
      } 
     }, 
     { 
      text:'Greetings', 
      handler: function() { 
      Ext.Msg.prompt('Greetings!','What is your name?', 
      function (btn,text){ 
       var response = new Ext.MessageBox().show({ 
       title: 'Howdy', 
       msg: 'Pleased to meet you ' + text, 
       }); 
      }); 
      } 
     }] 
     }] 
    }); 
    } 
}); 

,特别是:

new Ext.MessageBox().show({ 
    title: 'Howdy', 
    msg: 'Pleased to meet you ' + text, 
}); 

当我运行此,只有标题所示,没有显示消息:

problem

任何人都知道为什么会发生这种情况?

回答

5

试试这个:

new Ext.MessageBox().show({ 
    title: 'Howdy', 
    message: 'Pleased to meet you ' + text, 
}); 
+0

这个工作,非常感谢你的快速响应。 为什么没有在文档中提及...或任何地方。即使sencha.com上的例子显示'msg' – SnK 2012-07-09 09:45:02

+1

。检查http://docs.sencha.com/touch/2-0/#!/api/Ext.MessageBox-cfg-message下的配置 – Fbo 2012-07-09 09:51:21

+0

myes oke,但这是从来没有用过的任何例子 – SnK 2012-07-09 10:07:43