2014-01-16 29 views
0

我有這樣的構造:如何使用標題從參數顯示ExtJS的窗口

var sendMessagePopup = Ext.create('Ext.window.Window', { 
      title: 'Closing Doodad issue', 
      id: 'sendMessagePopUpJS', 
      width: 550, 
      height: 435, 
      loader: { 
       url: "@Url.Action("SendMessagePopup", "Message")?subject=" + "@Model.Obj1.Model.Obj1Number - completed this" + "&messageBody=I will close this doodad.", 
       loadMask: true, 
       autoLoad: false, 
       scripts: true, 
       renderer: 'html' 
      }, 
      autoScroll: true, 
      resizable: false, 
      layout: 'fit', 
      closable: true, 
      closeAction: 'hide', 
      modal: true, 
      header: true 
     }); 

我得到這個窗口通過調用它來顯示:

<a class="btn c10 buttonsRowForPreviewFixedWidth" onclick=" sendMessagePopup.show(); 
     sendCloseMessagePopup.loader.load(); ">Close Item</a> 

這個電流工作正常,但我想當用戶點擊相反的動作時重新使用它:打開一個裝飾問題。我已經爲頁面上的不同窗口添加了兩個構造函數。但這是第二個包含「Open Issue」文字無法正常工作的問題。

第二個按鈕:

<a class="btn c10 buttonsRowForPreviewFixedWidth" onclick="sendOpenMessagePopup.show(); 
    sendOpenMessagePopup.loader.load(); ">Open Item</a> 

我怎麼會去更改標題屬性,有的在裝載機的文本時,從加載此窗口「關閉該」或「打開此」按鈕。

編輯:我看過Extjs pass in parameters to window on show,但我不能使用show()。

回答

0

如果我正確地理解了你,你想在兩個不同的場合重新使用一個組件。在這種情況下,我會建議使用組件定義。

所以不是Ext.create('Ext.window.Window', {...})你應該使用

Ext.define('sendMessagePopUpJS', 
{ 
    extend  : 'Ext.window.Window', 
    width: 550, 
    height: 435, 

然後您可以創建每次點擊一個新的窗口,並通過它的一些選項,比如

Ext.create('sendMessagePopUpJS', 
{ 
    title: 'foo' 
}).show();