Alien-Web-ExtJS-V3

 view release on metacpan or  search on metacpan

share/docs/source/DataProxy.html  view on Meta::CPAN

    // This line caused a bug when people use custom Connection object having its own request method.
    // http://extjs.com/forum/showthread.php?t=67194.  Have to set DataProxy config
    //Ext.applyIf(this, conn);

    this.api     = conn.api;
    this.url     = conn.url;
    this.restful = conn.restful;
    this.listeners = conn.listeners;

    // deprecated
    this.prettyUrls = conn.prettyUrls;

<span id='Ext-data-DataProxy-cfg-api'>    /**
</span>     * @cfg {Object} api
     * Specific urls to call on CRUD action methods &quot;read&quot;, &quot;create&quot;, &quot;update&quot; and &quot;destroy&quot;.
     * Defaults to:&lt;pre&gt;&lt;code&gt;
api: {
    read    : undefined,
    create  : undefined,
    update  : undefined,
    destroy : undefined
}
     * &lt;/code&gt;&lt;/pre&gt;
     * &lt;p&gt;The url is built based upon the action being executed &lt;tt&gt;[load|create|save|destroy]&lt;/tt&gt;
     * using the commensurate &lt;tt&gt;{@link #api}&lt;/tt&gt; property, or if undefined default to the
     * configured {@link Ext.data.Store}.{@link Ext.data.Store#url url}.&lt;/p&gt;&lt;br&gt;
     * &lt;p&gt;For example:&lt;/p&gt;
     * &lt;pre&gt;&lt;code&gt;
api: {
    load :    '/controller/load',
    create :  '/controller/new',  // Server MUST return idProperty of new record
    save :    '/controller/update',
    destroy : '/controller/destroy_action'
}

// Alternatively, one can use the object-form to specify each API-action
api: {
    load: {url: 'read.php', method: 'GET'},
    create: 'create.php',
    destroy: 'destroy.php',
    save: 'update.php'
}
     * &lt;/code&gt;&lt;/pre&gt;
     * &lt;p&gt;If the specific URL for a given CRUD action is undefined, the CRUD action request
     * will be directed to the configured &lt;tt&gt;{@link Ext.data.Connection#url url}&lt;/tt&gt;.&lt;/p&gt;
     * &lt;br&gt;&lt;p&gt;&lt;b&gt;Note&lt;/b&gt;: To modify the URL for an action dynamically the appropriate API
     * property should be modified before the action is requested using the corresponding before
     * action event.  For example to modify the URL associated with the load action:
     * &lt;pre&gt;&lt;code&gt;
// modify the url for the action
myStore.on({
    beforeload: {
        fn: function (store, options) {
            // use &lt;tt&gt;{@link Ext.data.HttpProxy#setUrl setUrl}&lt;/tt&gt; to change the URL for *just* this request.
            store.proxy.setUrl('changed1.php');

            // set optional second parameter to true to make this URL change
            // permanent, applying this URL for all subsequent requests.
            store.proxy.setUrl('changed1.php', true);

            // Altering the proxy API should be done using the public
            // method &lt;tt&gt;{@link Ext.data.DataProxy#setApi setApi}&lt;/tt&gt;.
            store.proxy.setApi('read', 'changed2.php');

            // Or set the entire API with a config-object.
            // When using the config-object option, you must redefine the &lt;b&gt;entire&lt;/b&gt;
            // API -- not just a specific action of it.
            store.proxy.setApi({
                read    : 'changed_read.php',
                create  : 'changed_create.php',
                update  : 'changed_update.php',
                destroy : 'changed_destroy.php'
            });
        }
    }
});
     * &lt;/code&gt;&lt;/pre&gt;
     * &lt;/p&gt;
     */

    this.addEvents(
<span id='Ext-data-DataProxy-event-exception'>        /**
</span>         * @event exception
         * &lt;p&gt;Fires if an exception occurs in the Proxy during a remote request. This event is relayed
         * through a corresponding {@link Ext.data.Store}.{@link Ext.data.Store#exception exception},
         * so any Store instance may observe this event.&lt;/p&gt;
         * &lt;p&gt;In addition to being fired through the DataProxy instance that raised the event, this event is also fired
         * through the Ext.data.DataProxy &lt;i&gt;class&lt;/i&gt; to allow for centralized processing of exception events from &lt;b&gt;all&lt;/b&gt;
         * DataProxies by attaching a listener to the Ext.data.DataProxy class itself.&lt;/p&gt;
         * &lt;p&gt;This event can be fired for one of two reasons:&lt;/p&gt;
         * &lt;div class=&quot;mdetail-params&quot;&gt;&lt;ul&gt;
         * &lt;li&gt;remote-request &lt;b&gt;failed&lt;/b&gt; : &lt;div class=&quot;sub-desc&quot;&gt;
         * The server did not return status === 200.
         * &lt;/div&gt;&lt;/li&gt;
         * &lt;li&gt;remote-request &lt;b&gt;succeeded&lt;/b&gt; : &lt;div class=&quot;sub-desc&quot;&gt;
         * The remote-request succeeded but the reader could not read the response.
         * This means the server returned data, but the configured Reader threw an
         * error while reading the response.  In this case, this event will be
         * raised and the caught error will be passed along into this event.
         * &lt;/div&gt;&lt;/li&gt;
         * &lt;/ul&gt;&lt;/div&gt;
         * &lt;br&gt;&lt;p&gt;This event fires with two different contexts based upon the 2nd
         * parameter &lt;tt&gt;type [remote|response]&lt;/tt&gt;.  The first four parameters
         * are identical between the two contexts -- only the final two parameters
         * differ.&lt;/p&gt;
         * @param {DataProxy} this The proxy that sent the request
         * @param {String} type
         * &lt;p&gt;The value of this parameter will be either &lt;tt&gt;'response'&lt;/tt&gt; or &lt;tt&gt;'remote'&lt;/tt&gt;.&lt;/p&gt;
         * &lt;div class=&quot;mdetail-params&quot;&gt;&lt;ul&gt;
         * &lt;li&gt;&lt;b&gt;&lt;tt&gt;'response'&lt;/tt&gt;&lt;/b&gt; : &lt;div class=&quot;sub-desc&quot;&gt;
         * &lt;p&gt;An &lt;b&gt;invalid&lt;/b&gt; response from the server was returned: either 404,
         * 500 or the response meta-data does not match that defined in the DataReader
         * (e.g.: root, idProperty, successProperty).&lt;/p&gt;
         * &lt;/div&gt;&lt;/li&gt;
         * &lt;li&gt;&lt;b&gt;&lt;tt&gt;'remote'&lt;/tt&gt;&lt;/b&gt; : &lt;div class=&quot;sub-desc&quot;&gt;
         * &lt;p&gt;A &lt;b&gt;valid&lt;/b&gt; response was returned from the server having
         * successProperty === false.  This response might contain an error-message
         * sent from the server.  For example, the user may have failed
         * authentication/authorization or a database validation error occurred.&lt;/p&gt;
         * &lt;/div&gt;&lt;/li&gt;
         * &lt;/ul&gt;&lt;/div&gt;



( run in 1.189 second using v1.01-cache-2.11-cpan-0bd6704ced7 )