Extjs中的行编辑插件问题

时间:2015-04-28 09:48:15

标签: extjs sencha-cmd roweditor sencha-cmd5

我在ExtJs中有一个完全正常工作的liveSearchGridPanel。编辑任何行时发生错误。发生的事情是,如果更新的行必须像我的情况一样,当我改变用户的年龄(我按年龄排序)时,行在网格中上升或下降,但之前的记录仍然存在直到我手动刷新整个网页。屏幕截图位于

之下

Screen Shot of My web page after editing

我的代理模型是:

ra = (pa[1:] - pa[:-1]) / pa[:-1]
rb = (pb[1:] - pb[:-1]) / pb[:-1]

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' }); 的功能,但它没有用。

感谢您的时间。

1 个答案:

答案 0 :(得分:3)

请求完整答案:

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

相关问题