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 "read", "create", "update" and "destroy".
* Defaults to:<pre><code>
api: {
read : undefined,
create : undefined,
update : undefined,
destroy : undefined
}
* </code></pre>
* <p>The url is built based upon the action being executed <tt>[load|create|save|destroy]</tt>
* using the commensurate <tt>{@link #api}</tt> property, or if undefined default to the
* configured {@link Ext.data.Store}.{@link Ext.data.Store#url url}.</p><br>
* <p>For example:</p>
* <pre><code>
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'
}
* </code></pre>
* <p>If the specific URL for a given CRUD action is undefined, the CRUD action request
* will be directed to the configured <tt>{@link Ext.data.Connection#url url}</tt>.</p>
* <br><p><b>Note</b>: 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:
* <pre><code>
// modify the url for the action
myStore.on({
beforeload: {
fn: function (store, options) {
// use <tt>{@link Ext.data.HttpProxy#setUrl setUrl}</tt> 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 <tt>{@link Ext.data.DataProxy#setApi setApi}</tt>.
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 <b>entire</b>
// 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'
});
}
}
});
* </code></pre>
* </p>
*/
this.addEvents(
<span id='Ext-data-DataProxy-event-exception'> /**
</span> * @event exception
* <p>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.</p>
* <p>In addition to being fired through the DataProxy instance that raised the event, this event is also fired
* through the Ext.data.DataProxy <i>class</i> to allow for centralized processing of exception events from <b>all</b>
* DataProxies by attaching a listener to the Ext.data.DataProxy class itself.</p>
* <p>This event can be fired for one of two reasons:</p>
* <div class="mdetail-params"><ul>
* <li>remote-request <b>failed</b> : <div class="sub-desc">
* The server did not return status === 200.
* </div></li>
* <li>remote-request <b>succeeded</b> : <div class="sub-desc">
* 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.
* </div></li>
* </ul></div>
* <br><p>This event fires with two different contexts based upon the 2nd
* parameter <tt>type [remote|response]</tt>. The first four parameters
* are identical between the two contexts -- only the final two parameters
* differ.</p>
* @param {DataProxy} this The proxy that sent the request
* @param {String} type
* <p>The value of this parameter will be either <tt>'response'</tt> or <tt>'remote'</tt>.</p>
* <div class="mdetail-params"><ul>
* <li><b><tt>'response'</tt></b> : <div class="sub-desc">
* <p>An <b>invalid</b> 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).</p>
* </div></li>
* <li><b><tt>'remote'</tt></b> : <div class="sub-desc">
* <p>A <b>valid</b> 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.</p>
* </div></li>
* </ul></div>
( run in 1.189 second using v1.01-cache-2.11-cpan-0bd6704ced7 )