I'm developping an hybrid application with Worklight Ibm, using sencha touh for UI.
in my controller i'm calling an HTTPAdapter like this:
var invocationData = {
adapter : 'UserHttpAdapter',
procedure : 'getPersonneMorale',
parameters : []
};
WL.Client.invokeProcedure(invocationData, {
onSuccess : function() {
console.log('Signed in.');
var loginView = this.getLoginView();
mainMenuView = this.getMainMenuView();
loginView.setMasked(false);
Ext.Viewport.animateActiveItem(mainMenuView, this
.getSlideLeftTransition());
},
onFailure : function(){
console.log('failure');
},
});
but i'm getting this error:
07-07 11:43:45.812: E/NONE(31172): [http://<domain>:<port>/WLErsalMobileTest/apps/services/api/ErsalMobileTest/android/query] exception. TypeError: Object #<Object> has no method 'getLoginView'
07-07 11:43:45.832: D/CordovaLog(31172): file:///android_asset/www/default/worklight/worklight.js: Line 3333 : Uncaught TypeError: Object #<Object> has no method 'getLoginView'
07-07 11:43:45.832: E/Web Console(31172): Uncaught TypeError: Object #<Object> has no method 'getLoginView':3333
When i'm executing the code:
signInSuccess : function() {
console.log('Signed in.');
var loginView = this.getLoginView();
mainMenuView = this.getMainMenuView();
loginView.setMasked(false);
Ext.Viewport.animateActiveItem(mainMenuView, this.getSlideLeftTransition());
},
without calling the adapter it works.
Can you help me please!
Thank you
Try doing the following:
WL.Client.invokeProcedure.apply(this, [invocationData, callbackFunction])
where callbackFunction is the callback you have above. I think the problem is that the variable 'this' is not specified in the callback context, so by using apply, you are specifying that 'this' should be the value that you are specifying. Try that and see if it works, although I am not sure if it will solve your problem because I do not know if it will use the given 'this' in the callback function.