我如何在Ext.Msg函数中访问下面的alRec变量,现在无法访问。
var alRec = allRecords[i];
prefFlag = true;
Ext.Msg.show({
title:'Error',
msg:"SOME MESSAGE",
buttons: Ext.Msg.OKCANCEL,
animEl: 'wId',
icon: Ext.MessageBox.ERROR,
fn: function(button,alRec) {
if(button=='ok')
this.onApply();
else {
alRec.reject();
return false;
}
},
scope:this
});
答案 0 :(得分:1)
var alRec = ['a'];
Ext.Msg.show({
title:'Error',
alRec: alRec,
msg:"SOME MESSAGE",
buttons: Ext.Msg.OKCANCEL,
animEl: 'wId',
icon: Ext.MessageBox.ERROR,
fn: function(button){
console.log(this.alRec); //now its accesible
if(button=='ok')
this.onApply();
else
{
//sth to do
return false;
}
},
scope:this
});