2012-03-01 15 views
-2

私はExt.Msg関数内でalRec変数の下にアクセスできますが、今はアクセスできません。働いthis.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

、 – prakashkadakol

答えて

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