var data = Ext.create('Ext.data.Store', {
               fields:['name','sex','email','selfIntroduction', 'interest'],
                autoLoad: true,
                          proxy: {
                               type: 'ajax',
                                 url : 'http://localhost:8080/UserManage/userList',
                           reader: {
                         type: 'json',
                             root: 'users'
        }
    }
           });
           data.load(function(){alert("");});
           g = Ext.create('Ext.grid.Panel', {
             title: 'Simpsons',
             store: data,
             tbar:[{text:"添加",handler:addUserUI},{text:"修改",handler:updateUserUI},{text:"删除",handler:addUserUI}],
             columns: [
                 {header: 'name',  dataIndex: 'name'},
                 {header: 'sex', dataIndex: 'sex'},
                 {header: 'phone',  dataIndex: 'phone'},
                 {header: 'Email', dataIndex: 'emali'},
                 {header: 'selfIntroduction', dataIndex: 'selfIntroduction'},
                 {header: 'Phone', dataIndex: 'interest'}
             ],
             height: "100%",
             width: "100%",
             renderTo: Ext.getBody()
         });
           });可以访问到后台。。后台也能正确返回一个json对象。。可是就是不能加载到前台。。跪求大家帮帮忙

解决方案 »

  1.   

    1,root: 'users'
       返回的JSON名字是不是'users'
    -------------------------------------------------
    2,  type: 'rest',proxy: {
                                    type: 'rest',
                                    url: 'Json_for_GridPanel.aspx',
                                    reader: {
                                        type: 'json',
                                        root: 'data'
                                    },
                                    writer: {
                                        type: 'json'
                                    }
                            }这两个地方你对一个/应该就对了