1

我在 ExtJs 中有一个完整的 liveSearchGridPanel。编辑任何行时发生错误。发生的情况是,如果更新的行必须像我更改用户年龄(我根据年龄排序)那样在我的情况下使用,行在网格中上升或下降,但之前的记录也保留在那里直到我手动刷新整个网页。截图如下

编辑后我的网页的屏幕截图

我的代理模型是:

Ext.define('proxymodel', {
    extend: 'Ext.data.Model',
    fields: [{
        name: 'id',
        type: 'int',
        persist: false
    }, {
        name: 'gender',
        type: 'auto'
    }, {
        name: 'name',
        type: 'auto'
    }, {
        name: 'age',
        type: 'int'
    }],

    identifier: 'sequential', // to generate -1, -2 etc on the client
    proxy: {
        type: 'rest',
        //format: 'json',
        //appendId: false,
        idParam: "id",
        //limitParam:"",
        //filterParam: "",
        //startParam:'',
        //pageParam:'',
        url: 'http://localhost:3000/posts',
        api: {
            read: 'http://localhost:3000/db',
            create: 'http://localhost:3000/posts',
            update: 'http://localhost:3000/posts',
            destroy: 'http://localhost:3000/posts'

        },

        headers: {
            'Content-Type': "application/json"
        },

        reader: {
            type: 'json',
            rootProperty: 'posts',

            totalProperty: 'total'

        },
        writer: {
            type: 'json'
        }
    }
});

Application.js中,我将行编辑插件定义为:

var rowEditing = Ext.create('Ext.grid.plugin.RowEditing', {
    listeners: {
        cancelEdit: function(rowEditing, context) {
            // Canceling editing of a locally added, unsaved record: remove it
            if (context.record.phantom) {
                store.remove(context.record);
            }
        },

        edit: function(editor, e) {
            // commit the changes right after editing finished
            e.record.commit();
        }
    }
});

我的商店看起来像:

Ext.define('Store', {
    extend: 'Ext.data.Store',
    storeId: 'peopleStore',
    pageSize: 500,

    //buffered: true,
    //leadingBufferZone: 300,

    pageSize: 5,

    autoLoad: {
        start: 0,
        limit: 5
    },
    autoSync: true,

    sorters: [{
        property: 'age',
        direction: 'ASC'
    }],

    groupField: 'gender'
});

谁能指出我的错误?

我试图在“编辑”功能中编辑后重新加载我的商店,rowEditing但它没有用。

谢谢你的时间。

4

1 回答 1

3

作为请求的完整答案:

你试过Ext.data.StoreManager.lookup('peopleStore').reload()吗?

于 2015-04-28T11:15:06.803 回答