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

extjs 复杂格式的json数据解析
求大神帮忙!
{"IsSuccess":true,
"Data":{"Index":1,"Size":10,"RowCount":3,"PageCount":1,
"PageData":[{"Id":3,"GUID":"beca097f-acd8-4f28-8f32-3e1517aa568b","UserID":3,"UserGUID":"571f005f-4422-449c-8274-4da6f7aabf97","UserName":"王五","UserLoginName":"王五","UserLoginPassword":"4321","UserPhone":"654321","UserEmail":"asdf@qq.com"},
{"Id":2,"GUID":"26ae1659-8e1d-424e-b7d4-77bb3af8e55d","UserID":2,"UserGUID":"15bdf47e-5a73-4944-ac56-e5eeca98a8d9","UserName":"李四","UserLoginName":"lisi","UserLoginPassword":"1234","UserPhone":"123456","UserEmail":"asdf@qq.com"},
{"Id":1,"GUID":"7872a950-1773-4cef-819f-2dfd410a18f5","UserID":1,"UserGUID":"d868ee95-27f4-4841-be93-fdd04520d4b3","UserName":"张三","UserLoginName":"zhangsan","UserLoginPassword":"1111","UserPhone":"111111","UserEmail":"asdf@qq.com"}]}}

这种格式的json数据怎么解析,如何用一个数据模型接受,并且显示在grid里面

------解决方案--------------------
    Ext.onReady(function () {
        var store = Ext.create('Ext.data.Store', {
            fields: ["Id", "GUID", "UserID", "UserGUID", "UserName", "UserLoginName", "UserLoginPassword", "UserPhone", "UserEmail"],
            proxy: {
                type: 'ajax',
                url: 'data.txt',
                reader: {
                    type: 'json',
                    root: 'Data.PageData'///ext可以直接配置root
                }
            }, autoLoad: true
        });
        Ext.create('Ext.grid.Panel', {
            store: store,
            columns: [
        { text: 'Id', dataIndex: 'Id' },
        { text: 'GUID', dataIndex: 'GUID' },
        { text: 'GUID', dataIndex: 'GUID' },
        { text: 'UserName', dataIndex: 'UserName' }
    ],
            height: 200,
            width: 400,
         &nb