Results 1 to 2 of 2

Thread: Ext.ux.Ajax

  1. #1
    Sencha User
    Join Date
    May 2011
    Location
    Italy
    Posts
    74
    Vote Rating
    11
      0  

    Default Ext.ux.Ajax

    Here we go guys with a new extension!

    Ext.ux.Ajax seems to replace the old Ext.Ajax, indeed.
    Well, that's correct :P

    Ext.Ajax is just a singleton of Ext.data.Connection, while Ext.ux.Ajax is a singleton that uses Ext.data.Connection and Ext.ux.Deferred!
    And now, here I am to show you how Ext.ux.Ajax works

    Problem:

    Code:
    Ext.Ajax.request ({
        url: 'data.json' ,
        success: function (data) {
            Ext.Ajax.request ({
                url: 'data2.json' ,
                success: function (data2) {
                    Ext.Ajax.request ({
                        url: 'data3.json' ,
                        success: function (data3) {
                            alert ("It's so hard to reach the top!");
                        } ,
                        failure: errorHandler
                    });
                } ,
                failure: errorHandler
            });
        } ,
        failure: errorHandler
    });
    How Ext.ux.Ajax solves this problem:

    Code:
    Ext.ux.Ajax
        .request ('data.json')
        .then (Ext.ux.Ajax.request ('data2.json'), errorHandler)
        .then (Ext.ux.Ajax.request ('data3.json'), errorHandler)
        .then (function (data3) {
            alert ("Ah! That's much better ;)");
        }, errorHandler);
    There's no magic behind this extension: in the request method, the AJAX request is wrapped into a promise (Ext.ux.Deferred instance) and it is returned, making the class chainable.

    For more infos/examples/docs, see the github page: https://github.com/wilk/Ext.ux.Ajax

    Sencha Market: https://market.sencha.com/extensions/ext-ux-ajax

    Have fun, fellas!
    Wilk
    Last edited by Wilky; 22 May 2013 at 11:23 PM. Reason: added sencha market link

  2. #2
    Sencha - Sr Software Engineer mitchellsimoens's Avatar
    Join Date
    Mar 2007
    Location
    Gainesville, FL
    Posts
    39,553
    Vote Rating
    1272
      1  

    Default

    Just saw this thread like your other, nice
    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

Tags for this Thread

Posting Permissions

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