.. _overrides.ext.ajax:

Ext.Ajax Overrides
==================

GeoExt provides an override for the functionality in
`Ext.Ajax <http://dev.sencha.com/deploy/dev/docs/?class=Ext.Ajax>`_.  If you include
the :file:`override-ext-ajax.js` file in your build, any calls to ``Ext.Ajax``
methods will be routed through ``OpenLayers.Request`` methods.  The practical
implication of this is that you can set the ``OpenLayers.ProxyHost`` property
in your application and have this proxy used by Ext components that call
``Ext.Ajax`` methods.

To include :file:`override-ext-ajax.js` in your build, the GeoExt section in
your build config should look like one of the following:

.. code-block:: ini

    # include everything (including override-ext-ajax.js)
    [GeoExt.js]
    root = ../lib
    license = geoext-license.js
    exclude =
        GeoExt.js
        GeoExt/SingleFile.js


or

.. code-block:: ini

    # custom build
    [GeoExt.js]
    root = ../lib
    license = geoext-license.js
    include =
        overrides/override-ext-ajax.js
        # other files listed here ...


Workaround for Existing Builds
------------------------------

If you are using a build of GeoExt that includes the Ajax overrides (e.g. the
0.6 release or earlier), you can work around any issues you may have using this
override in your appliction by protecting the ``Ext.lib.Ajax`` object before
loading file:`GeoExt.js`.

The example markup below will remove the effect of the override on Ajax methods.

.. code-block:: html

    <script src="path/to/ext.js"></script>
    <script>
        Ext.lib._Ajax = Ext.lib.Ajax; // protect the original
        Ext.lib.Ajax = {};  // create dummy for override
    </script>
    <script src="path/to/GeoExt.js"></script>
    <script>
        Ext.lib.Ajax = Ext.lib._Ajax; // restore the original
    </script>

Note that issues with the Ajax override present in 0.6 will be fixed in
subsequent releases.