2011-12-13 83 views
4

我想創建一個dockedItem工具欄面板創建後:ExtJS的4添加工具欄面板dockeditems運行時

Ext.onReady(function() { 
    Ext.create('Ext.container.Viewport', { 
     layout: 'border', 
     items: [{ 
      region: 'center', 
      xtype: 'panel', 
      listeners: { 
       afterrender: function(panel) { 
        //Below gives: Uncaught TypeError: Object #<Object> has no method 'getItemId' 
        panel.dockedItems.add({ 
         xtype: 'toolbar', 
         dock: 'bottom', 
         items: [{ 
          text: 'adfsadf' 
         }] 
        }); 
       } 
      } 
     }, { 
      region: 'west', 
      title: 'west', 
      html: 'west', 
      width: 120 
     }, { 
      region: 'east', 
      title: 'east', 
      html: 'east', 
      width: 120 
     }, { 
      region: 'north', 
      html: 'north', 
      title: 'north', 
      height: 60 
     }, { 
      region: 'south', 
      html: 'south', 
      title: 'south', 
      height: 60 
     }] 
    }); 
}); 

的錯誤是:

Uncaught TypeError: Object #<Object> has no method 'getItemId' 

任何想法如何做這個?

回答

9

沒關係......比我想象的要簡單。

解決方案:

panel.addDocked({ ... });