dtotwai720621 2015-10-20 09:07
浏览 93
已采纳

Ext.grid.editorgrid - 如何只发送第一行编辑数据?

I´m stuck with this component. Every time I call the update script for the editorgrid, the data sent to the PHP is the first edited row, but if I edit a second row the data sent is the first row edited and the second row edited. If I edit a third one the case is the same, the data sent to the PHP is the first, second, and third edited rows. Is there a way to only send the data from the row edited?

Here is my code:

var MCompetidoresGrid = new Ext.grid.EditorGridPanel({
        store       : MCompetidoresStore,
        columns     : [
            MCompetidoresSm,
            {header:'id',               dataIndex:'id',         sortable: true, width:30,   },
            {header:'Empresa',          dataIndex:'id_empresa', sortable: true, width:120,  },
            {header:'CIF',              dataIndex:'cif',        sortable: true, width:120,  editor:MCompetidorestextField},  //NUEVO CAMPO 12-03-2015
            {header:'Acronimo',         dataIndex:'codigo',     sortable: true,  width:60,  editor:MCompetidorestextField},
            {header:'Competidor',       dataIndex:'nombre',     sortable: true, width:200,  editor:MCompetidorestextField},
            {header:'Descripcion',      dataIndex:'descripcion',sortable: true,  width:320, editor:MCompetidorestextField}
        ],
        sm          : MCompetidoresSm,
        border      : false,
        stripeRows  : true,
        viewConfig:{
            markDirty:false
        }
});

var MCompetidoresStore = new Ext.data.Store({
        id          : "id",
        proxy       : MCompetidoresProxy,
        reader      : MCompetidoresReader,
        writer      : MCompetidoresWriter,
        autoSave    : true
});

var MCompetidoresWriter = new Ext.data.JsonWriter({
        encode          : true,
        writeAllFields  : false 
});

var MCompetidoresReader = new Ext.data.JsonReader({
        totalProperty   : 'total',
        successProperty : 'success',
        messageProperty : 'message',
        idProperty      : 'id',
        root            : 'data'
    },[
            {name: 'id'},
            {name: 'id_empresa'},
            {name: 'cif'},     
            {name: 'codigo'},
            {name: 'nombre'},
            {name: 'descripcion'},
    ]); 

var MCompetidoresProxy = new Ext.data.HttpProxy({
        api: {
            read    : "./Competenciaphp/MtoMaestro/getContacts.php"+"?"+"cliente="+despliegue,
            create  : "./Competenciaphp/MtoMaestro/createContact.php"+"?"+"cliente="+despliegue,
            update  : "./Competenciaphp/MtoMaestro/updateContact.php"+"?"+"cliente="+despliegue,                    
            destroy : "./Competenciaphp/MtoMaestro/destroyContact.php"+"?"+"cliente="+despliegue
        },
    }); 
  • 写回答

1条回答 默认 最新

  • dongpo1203 2015-10-20 18:34
    关注

    I'm only familiar with local store but, if it's possible, I can suggest you to add a store.commitChanges() in your success event of the update.(something like we can do with an ajax call). Or add an update event in your store definition to do the commitChanges:

    var MCompetidoresStore = new Ext.data.Store({
            id          : "id",
            proxy       : MCompetidoresProxy,
            reader      : MCompetidoresReader,
            writer      : MCompetidoresWriter,
            autoSave    : true,
            listeners:
            { 
                update:function(){
                    this.commitChanges();
                }
            }
    });
    
    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论

报告相同问题?

悬赏问题

  • ¥60 版本过低apk如何修改可以兼容新的安卓系统
  • ¥25 由IPR导致的DRIVER_POWER_STATE_FAILURE蓝屏
  • ¥50 有数据,怎么建立模型求影响全要素生产率的因素
  • ¥50 有数据,怎么用matlab求全要素生产率
  • ¥15 TI的insta-spin例程
  • ¥15 完成下列问题完成下列问题
  • ¥15 C#算法问题, 不知道怎么处理这个数据的转换
  • ¥15 YoloV5 第三方库的版本对照问题
  • ¥15 请完成下列相关问题!
  • ¥15 drone 推送镜像时候 purge: true 推送完毕后没有删除对应的镜像,手动拷贝到服务器执行结果正确在样才能让指令自动执行成功删除对应镜像,如何解决?