Just a note for the Ext JS 4.x users... Ext.Ajax.request support synchronous calls natively:
Code:Ext.Ajax.request({
url : 'something.php',
async : false,
callback : function(opts, success, response) {...}
});
Printable View
Just a note for the Ext JS 4.x users... Ext.Ajax.request support synchronous calls natively:
Code:Ext.Ajax.request({
url : 'something.php',
async : false,
callback : function(opts, success, response) {...}
});
Thks, I need just that, in my case i call a dynamic model in the server inside the constructor of data.store. i hope my case work for another guys
hi, I want to create a synchronous ajax call by Ext.data.AjaxProxy in sencha touch 2.
but in sencha-touch-all-debug.js,the implementation of Ext.data.AjaxProxy didn't set an async parameter.
so I create a new define Ext.data.AjaxProxySync, and I add a config parameter,and set this parameter as false.Code:request.setConfig({
headers : this.getHeaders(),
timeout : this.getTimeout(),
method : this.getMethod(request),
callback : this.createRequestCallback(request, operation, callback, scope),
scope : this
});
but in the implement of request.setConfig(),async parameter will be push out.Code:Ext.define('Ext.data.proxy.AjaxSync', {
extend: 'Ext.data.proxy.Server',
requires: ['Ext.util.MixedCollection', 'Ext.Ajax'],
alias: 'proxy.ajaxsync',
alternateClassName: ['Ext.data.HttpProxy', 'Ext.data.AjaxProxySync'],
config: {
actionMethods: {
create : 'POST',
read : 'GET',
update : 'POST',
destroy: 'POST'
},
headers: {},
withCredentials: false,
async : false
},
doRequest: function(operation, callback, scope) {
var writer = this.getWriter(),
request = this.buildRequest(operation);
request.setConfig({
headers : this.getHeaders(),
timeout : this.getTimeout(),
method : this.getMethod(request),
callback : this.createRequestCallback(request, operation, callback, scope),
scope : this,
async : this.getAsync()
});
if (operation.getWithCredentials() || this.getWithCredentials()) {
request.setWithCredentials(true);
}
// We now always have the writer prepare the request
request = writer.write(request);
console.log('request.getCurrentConfig\n');
console.log(request.getCurrentConfig());
Ext.Ajax.request(request.getCurrentConfig());
return request;
},
//...,the same as Ext.data.proxy.Ajax
});
in this section, async parameter is not in defaultConfig,so I fail.Code:if (name in defaultConfig) {
configList.push(name);
nameMap = configNameCache[name];
this[nameMap.get] = this[nameMap.initGet];
}
can you tell me how to config the defaultConfig value or other solution?thank you very much!