0

所以我将 json 加载到商店,但网格中没有可见的数据。我究竟做错了什么?这是网格:

            {
                xtype: 'gridpanel',
                title: 'Clients List',

                store: Ext.create('Ext.data.Store', {

                    model: 'app.model.modelClients',

                    proxy: Ext.create('Ext.data.HttpProxy', {
                        type: 'ajax',
                        headers: { 'Accept': 'application/json' },
                        url: 'client.php',
                        noCache: false,
                        startParam: undefined,
                        filterParam: undefined,
                        limitParam: undefined,
                        pageParam: undefined
                    }),

                    reader: new Ext.data.JsonReader({
                        root: 'records',
                        id: 'id',
                        fields: ['first_name', 'last_name', 'phone']
                    }),

                    listeners: {
                        load: function (self, records, successful, eOpts) {
                            var fields = records[0].fields;
                            console.log(fields.getAt(0));
                        }
                    },

                    autoLoad: true
                }),

                flex: '1',
                columns: [
                    { text: 'Name', dataIndex: 'first_name' },
                    { text: 'Last Name', dataIndex: 'last_name' },
                    { text: 'Phone', dataIndex: 'phone' }                        
                ]
            }
4

1 回答 1

0

啊。您的读者处于错误的水平。它是代理的一部分

 proxy: {
    type: "ajax",
    url: "...",  
    reader: {
于 2013-08-05T04:55:26.620 回答