PDA

View Full Version : [BETA1] Ext.util.JSONP.request



tino7_03
2 Feb 2012, 9:53 AM
In my app I call " Ext.util.JSONP.request" but I recive the error about calling "request" for undefined...
It sounds as " Ext.util.JSONP" is not defined.
Is it possible?
In PR4 it works.
Thanks for help...

mitchellsimoens
2 Feb 2012, 12:02 PM
You need to require that class now

tino7_03
6 Feb 2012, 11:54 AM
Sorry, but I don't understant. I need an instance of Ext.util.JSONP?
Have you an example, please?

Actually this is my class:



Ext.define("Ext.gp.Jsonp", {
require:['Ext.util.JSONP'],
statics: {
getData:function(url,methodName,args,fnSuccessCallback,scope,timeout,waitMsgCmp,fnErrCallback){
if(timeout==undefined||timeout==null){
timeout=3000;
}
if(waitMsgCmp==undefined||waitMsgCmp==null){
waitMsgCmp=Ext.Viewport.xtype;
}
Ext.ComponentQuery.query(waitMsgCmp)[0].setMasked({ xtype:'loadmask',message: 'Attendere' });
timeout=setTimeout(function(){Ext.ComponentQuery.query(waitMsgCmp)[0].setMasked(false);fnErrCallback();}, timeout);
//Ext.util.JSONP.current = null;
Ext.util.JSONP.request({
scope:scope,
url: url,
params:{
methodName: methodName,
args:args,
time: new Date().getTime()
},
callbackKey: 'callback',
callback: function (jsonData) {
Ext.ComponentQuery.query(waitMsgCmp)[0].setMasked(false);
clearTimeout(timeout);
fnSuccessCallBack(jsonData,this);
}
});
}
}});

mitchellsimoens
6 Feb 2012, 12:00 PM
Ext.util.JSONP is a singleton

TommyMaintz
6 Feb 2012, 12:22 PM
Tino, in your example, I think you are doing it almost right :) Try using requires instead of require.

tino7_03
9 Feb 2012, 1:06 AM
Ops.... Syntax Error!!!!
Thanks