extjs编辑器网格更新导轨

问题描述

| 我正在尝试更新显示在编辑器网格中的记录..但是没有更新相同的记录,而是将新记录插入数据库中...我缺少什么?pllzz help ..以下是我的JsonStore代码
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应该是代表数据库中唯一行的字段。在这种情况下,也许是customer_id? 如果这不能解决问题,我将必须查看后端代码以查看保存的处理方式。