2013-08-28 63 views
1

中顯示HTML數據,我必須顯示覆雜的數據(i顯示了其放在桌子上),我使用xtemplate(我認爲這是最好的方式)像顯示它們EXTJS 4.1 - 如何GridPanel中

Ext.define('My.Example', { 
    extend: 'Ext.Panel' 
    , tbar:[{  
     text:'my button' 
    }] 
    ,tpl: '{data}' 
}); 

但我需要嵌入表後網格的樣子

|button|----| 
|---table---| 
|-----------| 
|-----------| 
|   | 
|---grid----| 
|-----------| 

我應該怎麼辦謝謝

回答

1

使用盒佈局:

Ext.onReady(function() { 

    new Ext.panel.Panel({ 
     width: 400, 
     height: 400, 
     renderTo: document.body, 
     layout: { 
      type: 'vbox', 
      align: 'stretch' 
     }, 
     tbar: [{ 
      text: 'Button' 
     }], 
     items: [{ 
      flex: 1, 
      html: 'Top data' 
     }, { 
      flex: 1, 
      xtype: 'gridpanel', 
      store: { 
       fields: ['name'], 
       data: [{ 
        name: 'Item 1' 
       }] 
      }, 
      columns: [{ 
       flex: 1, 
       text: 'Name', 
       dataIndex: 'name' 
      }] 
     }] 
    }); 

}); 
+0

我試圖改變HTML等:panel.items.items [0]。價值= '新數據';但不工作? 。 – freestyle

+1

'panel.items.first()更新( '富');' –

+0

呀這麼好,感謝ü:) – freestyle