煎茶架构师 从其他函数调用函数
Sencha Architect Calling function from other function
我有一个定义了几个函数的FormPanel(见下文)。我需要从另一个函数调用一个函数,但我得到错误我正在调用的函数是未定义的。如果我从OnMyButtonTap功能调用ShowInspections,它可以工作如果我从 LoginOk 函数调用 ShowInspections,它不起作用我不知所措,我相信这是一个范围问题,但如此新,我真的需要煎茶一些帮助。
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');
}
});
当前代码中有一些拼写错误。
this.ShowInspection);
应读作
this.ShowInspections();
这不是你的问题吗?
你错过了()到处,你只需要改变这样。LoginOk(),this。LoginFail() 等等等。显示检查()
相关文章:
- 在Jquery调用之间添加其他函数
- 这个关键字位于$.ajax()中,用于调用其他函数来设置url
- 调用geocomplete中的其他函数
- 如何在Javascript中创建一个调用其他函数的函数
- 我用脚本创建了一个按钮.我可以通过点击按钮调用其他函数吗?我这样做,但失败了
- 当其他函数调用Javascript时运行我的代码
- 如何取消调用链下游的其他 onclick 函数调用
- 一个 JavaScript 函数调用其他几个函数
- 从其他模板相关函数调用帮助程序函数
- JavaScript 加载其他脚本 - 调用函数 - 未定义
- 煎茶架构师 从其他函数调用函数
- 如何从其他 jsp 调用方法/函数以包含在另一个 jsp 的 jstree 中
- 发送请求以从其他服务器调用函数
- 使用此函数在回调中调用其他函数
- 从javascript中的其他命名函数调用命名函数
- 订阅和取消订阅包含对其他函数的调用的函数
- 等待函数完成对其他函数的调用
- 我可以使用按钮来调用函数,但不能从搜索设置的if语句中调用,但可以调用任何其他函数
- Node.js从其他函数调用函数不工作
- 存根函数在被其他函数调用时没有返回正确的值