1
我現在已經另一個大問題,我貼我的代碼,然後我問我的問題Ext JS的beforeedit
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.我的問題是,我不知道誰來評估這種情況,因爲在編輯之前,我有以前的值,但在編輯我已經改變了值...
Anyboby can幫我?感謝所有。
感謝我在幾個小時前的問題解決了 – Deckard27