2012-05-03 2 views
0

나는 여러 가지 함수가 정의 된 FormPanel (아래 참조)이 있습니다. 다른 함수에서 하나의 함수를 호출해야하지만, 호출하는 함수가 정의되지 않은 이라는 오류가 발생합니다. 나는 내가 LoginOk 기능에서 ShowInspections를 호출하는 경우가 작동 기능 OnMyButtonTap로부터의 ShowInspections를 호출 할 경우 내가 그것을 범위 문제입니다 생각하지만, 그래서 새로운 그것이 센차 정말 일부를 필요로 나는 딱하다 작동하지 않습니다 도움.Sencha Architect 다른 함수에서 호출하는 함수

Ext.define('MyApp.view.LoginPanel', { 
extend: 'Ext.form.Panel', 
alias: 'widget.Login', 

config: { 
    items: [ 
     { 
      xtype: 'fieldset', 
      height: 226, 
      width: 440, 
      title: 'Enter Login Information', 
      items: [ 
       { 
        xtype: 'textfield', 
        id: 'userid', 
        label: 'User ID', 
        labelWidth: '40%', 
        required: true 
       }, 
       { 
        xtype: 'textfield', 
        id: 'pswd', 
        label: 'Password', 
        labelWidth: '40%', 
        required: true 
       } 
      ] 
     }, 
     { 
      xtype: 'button', 
      height: 86, 
      itemId: 'mybutton', 
      text: 'Login' 
     } 
    ], 
    listeners: [ 
     { 
      fn: 'onMybuttonTap', 
      event: 'tap', 
      delegate: '#mybutton' 
     } 
    ] 
}, 

onMybuttonTap: function(button, e, options) { 
    doLogin(Ext.getCmp('userid').getValue(),Ext.getCmp('pswd').getValue(),this.LoginOk,this.LoginFail,this.LoginError); 

}, 

LoginOk: function() { 
    // 
    // this function is called from doLogin and it works 
    // 
    //GetInspections('01/01/2011','12/31/2012','','',this.ShowInspections,this.LoadDataFail,this.LoadDataError); 
    // the function GetInspections does work, but does not call the "ShowInspections" function 
    this.ShowInspection); // directly calling this function does NOT work either 
}, 

LoginFail: function() { 
    Ext.Msg.alert('Invalid User ID and/or Password.'); 

}, 

LoginError: function() { 
    Ext.Msg.alert('Login Error!'); 
}, 

LoadDataFail: function() { 
    Ext.Msg.alert('No Inspections found.'); 
}, 

LoadDataError: function() { 
    Ext.Msg.alert('Error Loading Inspections.'); 
}, 

ShowInspections: function() { 
    Ext.Msg.alert('got inspections'); 
} 

});

+0

내가 오전으로 변경해야하거나, 예제 코드도 기능하지 않는 모든 곳 GetInspections라는 함수? – WCWedin

답변

0

현재 코드에 일부 오타가 있습니다.

this.ShowInspections(); 

this.ShowInspection); 

을 읽어야가 문제 아닌가요?

0

당신이 놓친() 그냥 미친 등 this.LoginOk(), this.LoginFail()와 this.ShowInspections()

관련 문제