Results 1 to 3 of 3

Thread: Extend Ext.Ajax

  1. #1
    Sencha User
    Join Date
    Jun 2012
    Posts
    25
    Answers
    1
    Vote Rating
    1
      0  

    Default Answered: Extend Ext.Ajax

    Hello.
    Is it possible to extend Ext.Ajax class?
    For example:
    Code:
    Ext.define('Ext.Ajax', {
        extend: 'Ext.Ajax',
        listeners: {
            'requestcomplete': function(conn, response){
                console.log('Request is completed o_O');
            }
        },
        initComponent: function () {
            this.callParent(arguments);
        }
    });

  2. Ext.Ajax is a singleton instance of Ext.data.Connection. If you want a requestcomplete listener on it, just add it
    Code:
    Ext.Ajax.on( 'requestcomplete', somefunc );
    Otherwise, you need to extend Ext.data.Connection (because that is all Ext.Ajax is - check out its source code)
    http://docs.sencha.com/ext-js/4-1/so....html#Ext-Ajax

  3. #2
    Sencha Premium User Tim Toady's Avatar
    Join Date
    Feb 2010
    Location
    Pennsylvania
    Posts
    605
    Answers
    67
    Vote Rating
    286
      0  

    Default

    Ext.Ajax is a singleton instance of Ext.data.Connection. If you want a requestcomplete listener on it, just add it
    Code:
    Ext.Ajax.on( 'requestcomplete', somefunc );
    Otherwise, you need to extend Ext.data.Connection (because that is all Ext.Ajax is - check out its source code)
    http://docs.sencha.com/ext-js/4-1/so....html#Ext-Ajax

  4. #3
    Sencha User
    Join Date
    Jun 2012
    Posts
    25
    Answers
    1
    Vote Rating
    1
      0  

    Default

    Thank you!

    This works great!
    Code:
    Ext.util.Observable.observe(Ext.data.Connection);
    Ext.data.Connection.on('requestexception', function(conn, response) {
        if (response.status == 403)
        {
            ... myfunc() ...
        }
    });

Posting Permissions

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