2012-07-09 69 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