2012-05-03 16 views
0

私はいくつかの関数が定義されたFormPanel(下記参照)を持っています。 別の関数から1つの関数を呼び出す必要がありますが、呼び出す関数が定義されていないというエラーが表示されます。 OnMyButtonTap関数からShowInspectionsを呼び出すと、それは機能します LoginOk関数からShowInspectionsを呼び出すと、機能しません。 私はそれが範囲の問題だと思っていますが、それは新しいですので、Senchaは本当に必要です。 助けて。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.ShowInspection); 

this.ShowInspections(); 

ようになり、その問題はありませんか?あなたが見逃している

0

()どこでもあなただけ(this.LoginOk()、this.LoginFail()などとthis.ShowInspectionsように変更する必要があります)

関連する問題