Sencha Architect Вызов функции из другой функции

У меня есть FormPanel (см. ниже), в котором определено несколько функций. Мне нужно вызвать одну функцию из другой функции, но я получаю сообщение об ошибке, что функция, которую я вызываю, не определена. Если я вызываю ShowInspections из функции OnMyButtonTap, она работает. Если я вызываю ShowInspections из функции LoginOk, она НЕ работает. Я в растерянности. Я считаю, что это проблема области, но такая новая, Сенча, мне действительно нужна помощь.

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

});


person user1180618    schedule 03.05.2012    source источник
comment
Я сошел с ума, или в примере кода даже нет функции с именем GetInspections?   -  person WCWedin    schedule 16.05.2012


Ответы (2)


В текущем коде есть опечатка.

this.ShowInspection); 

следует читать как

this.ShowInspections(); 

Разве это не твоя проблема?

person Zoltan Magyar    schedule 20.06.2012

Вы пропустили () везде, где вам просто нужно изменить this.LoginOk(), this.LoginFail() и т. д. и this.ShowInspections()

person Ram G Athreya    schedule 06.09.2012