I have written a simple global function at the app.js
level of my sencha touch 2.1 application.
Now, based on the clues found here on stack and from other sources, all that i have to do to call it from everywhere is something like
TimeMobile.app.myGlobalFunction(params);
the point is, it does not work and i get the error:
Uncaught TypeError: Object [object Object] has no method 'getLocalLoggedUserDetails'
I tried to call the launch()
function instead and that is working.
This is puzzling me more than before because at this point it's not a syntax problem.
I call the global function like this:
var LoggedUserDetails = TimeMobile.app.getLoggedUserDetails(true);
and my app.js is defined like this:
Ext.Loader.setConfig({
enabled: true
});
Ext.application({
models: [
'LoginResponse'
],
stores: [
'LoginStore',
'PlannedActivityListStore',
'RemoteUserDetailsStore',
'LocalUserDetailsStore'
],
views: [
'LoginView'
],
name: 'TimeMobile',
controllers: [
'ctlLogin',
'ctlPlannedActivities'
],
launch: function() {
//this.TimeMobile =this;
TimeMobile.app.LoggedUser ='';
TimeMobile.app.LoggedUserPsw ='';
TimeMobile.app.AnagId = 'CTEL';
TimeMobile.app.CurrentDate = new Date().toISOString();
TimeMobile.app.LoggedUserDetails = TimeMobile.model.mdlUserDetails();
Ext.create('TimeMobile.view.LoginView', {fullscreen: true});
},
getLoggedUserDetails: function(enabled) {
if (enabled)
{
//var store= TimeMobile.app.LocalUserDetailsStore();
//return store.getAt(0);
console.log('called');
}
else
{
return null;
}
}
});
When I call getLoadedUserDetails
with the syntax TimeMobile.app.getLoadedUserDetails(true);
I get the error previously mentioned.
TimeMobile.getLoadedUserDetails(true);
does not work either.
Any suggestions?