Ruby on rails extjs编辑器网格更新rails
我正在尝试更新编辑器网格中显示的记录..但不是更新同一记录,而是将一条新记录插入到数据库中…我缺少什么?pllzz帮助..以下是我的JsonStore代码:Ruby on rails extjs编辑器网格更新rails,ruby-on-rails,extjs,editor,grid,Ruby On Rails,Extjs,Editor,Grid,我正在尝试更新编辑器网格中显示的记录..但不是更新同一记录,而是将一条新记录插入到数据库中…我缺少什么?pllzz帮助..以下是我的JsonStore代码: Ext.data.Api.restActions = { create : 'POST', read : 'GET', update : 'PUT', destroy : 'DELETE' }; ProdStore = Ext.extend(Ext.data.JsonStore, { constructor: funct
Ext.data.Api.restActions = {
create : 'POST',
read : 'GET',
update : 'PUT',
destroy : 'DELETE' };
ProdStore = Ext.extend(Ext.data.JsonStore, {
constructor: function(cfg) {
cfg = cfg || {};
ProdStore.superclass.constructor.call(this, Ext.apply({
storeId: 'ProdStore',
id:'ProdStore',
url: 'products.json',
root: 'proddata',
restful:true,
idProperty:'id',
successProperty:'success',
autoLoad:true,
autoSave:false,
batch:true,
writer: new Ext.data.JsonWriter({
encode: false,
listful: false,
writeAllFields: false}),
fields: [
{ name:'customer_id'},{ name: 'prodnm'},
{ name: 'qty'}, { name: 'rate' }, { name: 'amt'}
]
}, cfg));
}
});
new ProdStore();
存储上设置的idProperty应该是表示数据库中唯一行的字段。在这种情况下,可能是客户id 如果这不能解决问题,我将不得不查看后端代码以了解如何处理保存