日期:2014-05-16  浏览次数:20359 次

Extjs:Grid没显示后台返回的Json数据

success: function(response){
    var rs = Ext.JSON.decode(response.responseText);
    Ext.Msg.alert("按钮", rs.data);
 // process server response here
    var store = new Ext.data.Store({  
    data:rs.data,
    fields:['provider','location','currency'
,'startnum1','startunit1','endnum1','endunit1','price1','priceunit1'
,'startnum2','startunit2','endnum2','endunit2','price2','priceunit2'
,'startnum3','startunit3','endnum3','endunit3','price3','priceunit3']  
    });  
    console.info(rs);
    this.getSGrid().reconfigure(store);
    console.info(this.getSGrid().store.data);
    //看到store有很多条记录但都是空的
}


后台返回的数据rs.data是:
[{"endunit3":"TB","endnum1":"1.0","endnum2":"10.0","endunit2":"TB","endunit1":"TB","provider":"Google","endnum3":"100.0","startnum3":"10.0","startnum2":"1.0","startnum1":"0.0","currency":"dollar","startunit1":"TB","startunit3":"TB","startunit2":"TB"},{"endunit3":"TB","endnum1":"1.0","endnum2":"10.0","endunit2":"TB","endunit1":"TB","provider":"Google","endnum3":"100.0","startnum3":"10.0","startnum2":"1.0","startnum1":"0.0","currency":"dollar","startunit1":"TB","startunit3":"TB","startunit2":"TB"}]


Grid绘制出来但是没有数据。
Grid的代码:

{
    xtype:'grid',
    id:'sgrid',
    store:{
        fields: ['provider','location','currency'
            ,'startnum1','startunit1','endnum1','endunit1','price1','priceunit1'
            ,'startnum2','startunit2','endnum2','endunit2','price2','priceunit2'
            ,'startnum3','startunit3','endnum3','endunit3','price3','priceunit3']
    },
    title: "search result",
    width: 1000,
    autoHeight: true,
    columns:[
    {text: "provider", width: 80, dataIndex: "provider", tooltip: "provider"},
    {text: "location", width: 80, dataIndex: "location", align: "center"},
    {text: "currency", width: 50, dataIndex: "currency"},
    {text: "startnum1", width: 50, dataIndex: "startnum1", align: "center"},