2010-05-29 43 views
0

是否可以從服務器獲取每個數據?例如,我想通過發送json字符串從服務器通過Ajax/Proxy獲取列項目? 謝謝Extjs - 從服務器獲取更多

 
var grid = new Ext.grid.GridPanel({ 
store: store, 
columns: [ 
{id:'company',header: 'Company', width: 160, sortable: true, dataIndex: 'company'}, 
{header: 'Price', width: 75, sortable: true, renderer: 'usMoney', dataIndex: 'price'}, 
{header: 'Change', width: 75, sortable: true, renderer: change, dataIndex: 'change'}, 
{header: '% Change', width: 75, sortable: true, renderer: pctChange, dataIndex: 'pctChange'}, 
{header: 'Last Updated', width: 85, sortable: true, renderer: Ext.util.Format.dateRenderer('m/d/Y'), dataIndex: 'lastChange'} 
], 
stripeRows: true, 
autoExpandColumn: 'company', 
height: 350, 
width: 600, 
title: 'Array Grid', 
stateful: true, 
stateId: 'grid' 
}); 

回答

0

是的,你可以。

您可以在服務器生成的示例中獲取整個代碼並在客戶端上評估,或者您可以將例如作爲JSON對象返回的列數組由客戶端解析,然後使用創建的對象作爲創建網格的代碼中的「列」配置選項。

由於JavaScript被解釋,你可以從服務器上下載文本,你可以做任何這樣的技巧。

0

通過「metaData」屬性發送數據。因此,該商店將觸發一個「metachange」事件,你可以用下面的方法對電網進行重新配置:

grid.reconfigure(store, new Ext.grid.ColumnModel(metaData.columns)); 
+0

它沒有元數據,請確保它是一個大寫字母「d」:薈萃「d」 ATA – CrazyEnigma 2010-07-16 17:46:55