EXT js beforeedit

时间:2013-06-18 07:29:55

标签: extjs grid

我现在有另一个大问题,我粘贴我的代码然后问我的问题

 var gridTablaConsulta = Ext.create('Ext.grid.GridPanel', {
    title:'Consulta Tabla lotes',
    id:'gridTabla',
    store: storeTabla,
    columns: [
        Ext.create('Ext.grid.RowNumberer'),
        {text: "NRBE", width: 60, sortable: true, dataIndex: 'NRBE'},
        {text: "APLIC", width: 60, sortable: true, dataIndex: 'APLIC'},
        {text: "FORM", width: 60, sortable: true, dataIndex: 'FORM'},
        {text: "VERFOR", width: 60, sortable: true, dataIndex: 'VERFOR'},
        {text: "FECLOT", width: 60, sortable: true, dataIndex: 'FECLOT'},
        {text: "HORLOT", width: 60, sortable: true, dataIndex: 'HORLOT'},
        {text: "TIPPAPLO", width: 60, sortable: true, dataIndex: 'TIPPAPLO'},
        {text: "TAMPAP", width: 60, sortable: true, dataIndex: 'TAMPAP'},
        {text: "FECINIIM", width: 60, sortable: true, dataIndex: 'FECINIIM'},
        {text: "FECINIOB", width: 60, sortable: true, dataIndex: 'FECINIOB',editor:     {xtype:'textfield', allowBlank:true}},
        {text: "ESTLOT", width: 60, sortable: true, dataIndex:'ESTLOT',editor:{xtype:'textfield', allowBlank:true}},
        {text: "TOTPAGGE", width: 60, sortable: true, dataIndex: 'TOTPAGGE'},
        {text: "TOTPAGIM", width: 60, sortable: true, dataIndex: 'TOTPAGIM'},
        {text: "DESLOT", width: 60, sortable: true, dataIndex: 'DESLOT'},
        {text: "TIPDIF", width: 60, sortable: true, dataIndex: 'TIPDIF'},
        {text: "DIADIF", width: 60, sortable: true, dataIndex: 'DIADIF'},
        {text: "FECALT", width: 60, sortable: true, dataIndex: 'FECALT'},
        {text: "FECMOD", width: 60, sortable: true, dataIndex: 'FECMOD'},
        {text: "TERMOD", width: 60, sortable: true, dataIndex: 'TERMOD'},
        {text: "HORMOD", width: 60, sortable: true, dataIndex: 'HORMOD'}
    ],
    selType: 'rowmodel',
    plugins: [
        Ext.create('Ext.grid.plugin.RowEditing', {
            clicksToEdit: 2
        })
    ],

    listeners: {

        beforeedit: function(editor, e, eOpts) {
            var grid = Ext.getCmp('gridTabla'); // or e.grid
            if (e.record.data.ESTLOT === '02') {
                e.cancel = true; //no permite
            } else {
                e.cancel = false; //permite
            }
            if (e.record.data.ESTLOT === '01') {
                e.cancel = false; //no permite
            } 


        },

         edit: function(e, context){
             var record = context.record;
             var recordData = record.getData();
             recordData.Funcionalidad = 'Modificar';
             alert(JSON.stringify(recordData));
             Ext.Ajax.request({
                 url: 'http://localhost:8080/MyMaver/ServletTablaLotes',
                 method: 'POST',

                 // merge row data with other params
                 params: recordData
             });
         }
        }
});

好的,现在我的问题,问题是在我之前,我需要检查一个条件,允许我将字段“ESTLOT”更改为前一个值的另一个值,例如,如果ESTLOT值为04和05,在那个领域ESTLOT可能是01或03,但如果值是06或03,它可能是04或05.我的问题是我不知道谁评估这种情况,因为在beforeedit我有前一个值但在编辑中,我的价值已经改变了......

Anyboby可以帮助我吗?谢谢大家。

1 个答案:

答案 0 :(得分:1)