1
ExtJs中有一个完整的liveSearchGridPanel。编辑任何行时发生错误。发生的事情是,如果更新的行必须像我的情况那样在我改变用户的年龄(我根据年龄进行排序)时使用,但行在网格中上升或下降,但之前的记录也保持在那里直到我手动刷新整个网页。截图低于Extjs中行编辑插件的问题
我的代理模式是:
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();
}
}
});
我的店是这样的:
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的'编辑'功能编辑后重新加载我的商店,但它没有奏效。
谢谢你的时间。
你试过'Ext.data.StoreManager.lookup('peopleStore')。reload()'? – Tyr
@Tyr谢谢,这工作。请你把它作为答案,以便我可以接受它,并且这个线程会让我为将来的用户回答问题。 –