Page 6 of 6 FirstFirst ... 456
Results 51 to 53 of 53

Thread: Synchronous Ajax Call

  1. #51
    Sencha - Sr Software Engineer mitchellsimoens's Avatar
    Join Date
    Mar 2007
    Location
    Gainesville, FL
    Posts
    39,556
    Vote Rating
    1272
      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 @LikelyMitch
    Sencha Inc, Senior Software Engineer
    ________________
    Learn BBCode and use it! Checkout the CODE tag!

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

  2. #52
    Sencha User
    Join Date
    Jan 2012
    Posts
    2
    Vote Rating
    0
      0  

    Default 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
      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!

Page 6 of 6 FirstFirst ... 456

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •