我试图在可编辑的网格中将记录从beforeedit传递给EXT中的edit,因为我需要根据该字段以前的值进行验证。例如,我有行(电话号码),当我试图编辑该字段时,我只能在电话从6开始时才能编辑,但如果电话从9开始,我只能将其更改为另一个以9开头的电话。
我在代码中使用了next,但我不知道如何将之前要编辑的值传递给edit函数。下面是我的代码:
listeners: {
beforeedit: {
scope: this,
fn: function(e, context2){
var record2= context2.record;
var recordData2=record2.getData();
alert(JSON.stringify(recordData2));
}
},
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
});
}
}如何将前一个值引用到edit:函数?
发布于 2013-06-17 21:11:43
试试这个:
beforeedit: function(editor, e, eOpts) {
var grid = Ext.getCmp('gridId'); // or e.grid
if (e.record.data.phoneNumber === 'your condition') {
//you code ..
e.cancel = false; //may edit the record
} else {
e.cancel = true; //not allowed to edit
}
},https://stackoverflow.com/questions/17143238
复制相似问题