我在 Extjs4 中工作,我被困在我想在另一个函数中调用一个函数的地方。
这里我将在成功函数中调用 hideLoginWindow() 函数。
如何在成功函数中调用 hideLoginWindow() 函数。这是我的控制器文件代码
Ext.define('Am.controller.sn.UserController',
{
extend:'Ext.app.Controller',
stores:['sn.UserStore','sn.SecurityquestionStore'],
models:['sn.UserModel','sn.SecurityquestionModel'],
views:['sn.user.Login','sn.user.Registration','sn.user.ForgetMyKey','sn.user.SecurityQuestion','sn.user.KpLogin'],
init:function()
{
console.log('Initialized Users! This happens before the Application launch function is called');
this.control(
{
'Login button[action=loginAction]':
{
click:this.authenticateUser
},
'Login button[action=registerAction]':
{
click:this.registerUser
},
'KpLogin button[action=loginAction]':
{
click:this.authenticateUser
}
});//end of this.control
},//end of init function
authenticateUser:function(button)
{
***// this function is called
this.temp();***
var email=this.getUserName().getValue();
var password=this.getPassword().getValue();
console.log("Email"+email);
console.log("Password"+password);
var check = Ext.ModelManager.create(
{
primaryEmail:email,
password: password,
}, 'Am.model.sn.UserModel');
check.save(
{
success: function(record, operation)
{
if(operation.request.scope.reader.jsonData["id"]==1)
{
// Code for geting component
alert("you are logged in successfully");
**//this function is not called
this.hideLoginWindow(); // I tried also hideLoginWindow();**
}//end of if statement
},//End of success function
failure: function(record, operation)
{
console.log("Inside failure function");
},//End of failure function
});// End of check save function
console.log("outside authenticated function");
},//end of authenticate user function
//***************************Reusable functions********************
// this function get called
temp:function()
{
console.log("Temp function called");
},
//this function is not get called
hideLoginWindow:function()
{
var obj=Ext.ComponentQuery.query('#loginId');
console.log("Object name = "+obj[0].id);
obj[0].hide();
}
});// End of login controller
当我运行此代码时,我收到错误消息
未捕获的类型错误:对象 [object Object] 没有方法“hideLoginWindow”
如何在成功函数中调用 hideLoginWindow() 函数。