2012-04-30 28 views
0

如何動態地改變listpanel標題? 我有一個導航視圖,其中listpanel是項目。所以導航欄會顯示我將動態更改的面板標題。Sencha動態地改變Ext.Panel標題

圖像: http://postimage.org/image/evxdv8fh9/

感謝。

listpanel = new Ext.Panel({ 
         layout: 'fit', 
         id:'listpanel', 
         title:'change this title dinamically', 
         items: [ 
           { 
            xtype: 'titlebar', 
            id: 'myTitle', 
            docked: 'top', 
            title: 'title1' 
           }, 
           { xtype: 'titlebar', 
            id: 'myMeanConsumption', 
            docked: 'bottom', 
            title: 'title2' 
           }, 
            list 
           ] 
        }); 

回答

1

做這樣的,

Ext.getCmp('myTitle').setTitle('Changed Title'); 

編輯:

title財產上不可Ext.Panel組件。因此,下面的行是多餘的。

title:'change this title dinamically', 

您需要更改titlebar只有我上面已經提到的title

我看不到listpanel標題。

enter image description here

+0

它說我有對象的setTitle – michele

+0

沒有一種方法我已經HA來改變listpanel標題 – michele

+0

'Ext.getCmp( 'myTitle') ''會讓你成爲'titlebar'組件。對其應用'setTitle()'將改變'titlebar'的標題。你在哪裏遇到問題? –

0

創建listpanel後補充一點:

listpanel.onAfter('painted', function() { 
listpanel.getNavigationBar().setTitle(newTitle); }, listpanel, { delay: 100 });