1. #51
    Sencha - Senior Forum Manager mitchellsimoens's Avatar
    Join Date
    Mar 2007
    Location
    St. Louis, MO
    Posts
    33,656
    Vote Rating
    435
    mitchellsimoens has much to be proud of mitchellsimoens has much to be proud of mitchellsimoens has much to be proud of mitchellsimoens has much to be proud of mitchellsimoens has much to be proud of mitchellsimoens has much to be proud of mitchellsimoens has much to be proud of mitchellsimoens has much to be proud of mitchellsimoens has much to be proud of

      0  

    Default


    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) {...}
    });
    Mitchell Simoens @SenchaMitch
    Sencha Inc, Senior Forum Manager
    ________________
    http://www.JSONPLint.com - Source to lint your JSONP!

    Check out my GitHub, lots of nice things for Ext JS 4 and Sencha Touch 2
    https://github.com/mitchellsimoens

    Think my support is good? Get more personalized support via a support subscription. https://www.sencha.com/store/

    Need more help with your app? Hire Sencha Services services@sencha.com

    Want to learn Sencha Touch 2? Check out Sencha Touch in Action that is almost in print!

    When posting code, please use BBCode's CODE tags.

  2. #52
    Sencha User
    Join Date
    Jan 2012
    Posts
    2
    Vote Rating
    0
    sergilored is on a distinguished road

      0  

    Default Thks i call a dynamic model in the server inside the constructor of data.store.

    Thks i call a dynamic model in the server inside the constructor of data.store.


    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

  3. #53
    Sencha User
    Join Date
    Aug 2012
    Posts
    5
    Vote Rating
    0
    wincvs is on a distinguished road

      0  

    Default


    Quote Originally Posted by mitchellsimoens View Post
    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) {...}
    });
    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.
    Code:
    request.setConfig({
    	headers        : this.getHeaders(),
    	timeout        : this.getTimeout(),
    	method         : this.getMethod(request),
    	callback       : this.createRequestCallback(request, operation, callback, scope),
    	scope          : this		
    });
    so I create a new define Ext.data.AjaxProxySync, and I add a config parameter,and set this parameter as false.
    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
    });
    but in the implement of request.setConfig(),async parameter will be push out.
    Code:
    if (name in defaultConfig) {
    	configList.push(name);
    	nameMap = configNameCache[name];
    	this[nameMap.get] = this[nameMap.initGet];
    }
    in this section, async parameter is not in defaultConfig,so I fail.
    can you tell me how to config the defaultConfig value or other solution?thank you very much!