ext grid 數據不顯示

ext grid 數據不顯示解決方案:
1)首先看grid的數據是否獲取到了;
2)若數據獲取到了且數據格式正確,再看前端Ext.grid.GridPanel是否寫的正確,store和列模型是否相對應,如:
new Ext.grid.ColumnModel([
new Ext.grid.CheckboxSelectionModel(),
{header:'移動電話',width:100,sortable:true,[color=red]dataIndex:'mobile'[/color]},
{header:'固定電話',width:100,sortable:true,[color=red]dataIndex:'workTel'[/color]},
{header:'傳真',width:100,sortable:true,[color=red]dataIndex:'fax'[/color]},
{header:'公司地址',width:100,sortable:true,[color=red]dataIndex:'address'[/color]},
{header:'郵編',width:100,sortable:true,[color=red]dataIndex:'postcode'[/color]}
]);
new Ext.data.Store({
proxy:new Ext.data.MemoryProxy(gridStore),
reader:new Ext.data.ArrayReader({},['mobile','workTel','fax','address','postcode'])
})

3)若以上兩條都沒有問題,但數據就是不顯示,就在store的reader中添加autoLoad:true,如:
store : new Ext.data.Store({
proxy:new Ext.data.MemoryProxy(gridStore),
reader:new Ext.data.ArrayReader({},['fieldId','fieldName']),
[color=red]autoLoad:true[/color]
})

這樣數據就能顯示了
發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章