1

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

 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
             });
         }
        }
});

好的,现在我的问题是,问题是在我的 beforeedit 中,我需要检查一个条件,该条件允许我将字段“ESTLOT”更改为取决于先前值的另一个值,例如,如果 ESTLOT 值是 04 和 05,在该字段中,ESTLOT 可能是 01 或 03,但如果值为 06 或 03,则可能是 04 或 05。我的问题是我不知道该由谁来评估这种条件,因为在 beforeedit 中我有以前的值但在编辑中我已经改变了价值......

任何人都可以帮助我吗?谢谢大家。

4

1 回答 1

1

你有两个值,你只是不知道它们在哪里:e.valuee.originalValue

http://docs.sencha.com/extjs/4.1.1/#!/api/Ext.grid.Panel-event-beforeedit

http://docs.sencha.com/extjs/4.1.1/#!/api/Ext.grid.Panel-event-edit

于 2013-06-19T10:36:48.197 回答