Results 1 to 2 of 2

Thread: How to Extend a Provider

  1. #1
    Sencha User
    Join Date
    Nov 2010
    Vote Rating

    Default How to Extend a Provider

    Hi all

    I had an application with Extjs3 and I'm now migrating to ExtJS4.
    In this application I have a custom provider to work with ejabber. This was working perfectly with extjs3.

    When I try to integrate it to my Extjs4 application, I'm not able to declare it.
    I'm not able to make it accessible from my application.
    I have the source code of my extended provider in a js file. I add it in the "require" section of my main file. I can see it loaded in firebug. But each time I try to use function with a provider of my newly created provider, it is failing..
    In the very first lines of the Ext.Direct.Manager.Provider in the function addprovider, I see that ExtJS4 is searching for the provider in package Ext.Direct.Manager + "type of the provider" + Provider .
    Does it means that to be able to extend a provider, I have to create the new provider in the package Ext.Direct.Manager ? It seems strange for me.
    I probably miss something and I really need help as I tried so many things to make it work but without any success and the communication with ejabber through events is the core of my application.

    Thanks for your help to anybody could help me to solve this issue.

  2. #2
    Sencha User
    Join Date
    Jan 2008
    Vote Rating


    I know this is an old thread, but since noone gave a solution and google points to it, here is the solution I found:

    Ext.define('', {    
        alias: 'direct.zendprovider',
        extend: ''
    And this is all you need to extend it.

    To use it:

        enableUrlEncode : 'extDirectData',
        url             : './mymodule',
        format          : 'json',
        type            : 'zend',
        actions         : {
            index : [{
                name   : 'logout',
                len    : 0
        namespace : 'myapp.mymodule.provider'
    To call it:

    Also to make this code fully functional, you need to add:
    Ext.Ajax.on('beforerequest', function(conn, options) {
        if (options.transaction && options.transaction.provider && options.transaction.provider.type == 'zend') {
            var controller = options.transaction.action;
            controller = controller.replace(/([a-z])([A-Z])/g, "$1.$2").toLowerCase();
            var action    = options.transaction.method;
            action = action.replace(/([a-z])([A-Z])/g, "$1.$2").toLowerCase();
            var url = options.url;
            url     = url +
                       (url.lastIndexOf('/') == url.length-1 ? '' : '/') +
                       controller +
                       '/' +
            if (options.transaction.provider.format) {
                url += '/format/' + options.transaction.provider.format;
            options.url            = url;
            options.disableCaching = true;
    This code is taken and made to work with ExtJs 4.0 from Conjoon (nice cute zend framework+extjs opensource application).

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