| doRequest : FunctionAbstract method that should be implemented in all subclasses. Note: Should only be used by custom-proxy developers.
... Abstract method that should be implemented in all subclasses. Note: Should only be used by custom-proxy developers.
-(e.g.: HttpProxy.doRequest,
+ An implementation of Ext.data.DataProxy that simply passes the data specified in its constructor
+to the Reader when its load method is called. Config Options|
| api : ObjectSpecific urls to call on CRUD action methods "read", "create", "update" and "destroy".
+Defaults to:api: {
+ read ... Specific urls to call on CRUD action methods "read", "create", "update" and "destroy".
+Defaults to: api: {
+ read : undefined,
+ create : undefined,
+ update : undefined,
+ destroy : undefined
+}
+ The url is built based upon the action being executed [load|create|save|destroy]
+using the commensurate api property, or if undefined default to the
+configured Ext.data.Store.url.
+ For example:
+ 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'
+}
+ If the specific URL for a given CRUD action is undefined, the CRUD action request
+will be directed to the configured url.
+ Note: 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:
+ // modify the url for the action
+myStore.on({
+ beforeload: {
+ fn: function (store, options) {
+ // use setUrl 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 setApi.
+ 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 entire
+ // 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'
+ });
+ }
+ }
+});
+ | DataProxy | | doRequest : FunctionAbstract method that should be implemented in all subclasses. Note: Should only be used by custom-proxy developers.
+... | DataProxy | | listeners : ObjectA config object containing one or more event handlers to be added to this
object during initialization. This should ... A config object containing one or more event handlers to be added to this
object during initialization. This should be a valid listeners config object as specified in the
@@ -115,37 +118,37 @@ Ext.DomObserver = Ext.extend(Object, {
typeAhead: true,
mode: 'local',
triggerAction: 'all'
-}); | Observable | | onRead : FunctionAbstract method that should be implemented in all subclasses. Note: Should only be used by custom-proxy developers. ... Abstract method that should be implemented in all subclasses. Note: Should only be used by custom-proxy developers. Callback for read action. | DataProxy | | onWrite : FunctionAbstract method that should be implemented in all subclasses. Note: Should only be used by custom-proxy developers. ... Abstract method that should be implemented in all subclasses. Note: Should only be used by custom-proxy developers. Callback for create, update and destroy actions. | DataProxy | | restful : BooleanDefaults to false. Set to true to operate in a RESTful manner.
- Note: this parameter will automatically be set to t... Defaults to false. Set to true to operate in a RESTful manner.
- Note: this parameter will automatically be set to true if the
-Ext.data.Store it is plugged into is set to restful: true . If the
-Store is RESTful, there is no need to set this option on the proxy.
- RESTful implementations enable the serverside framework to automatically route
-actions sent to one url based upon the HTTP method, for example:
- store: new Ext.data.Store({
- restful: true,
- proxy: new Ext.data.HttpProxy({url:'/users'}); // all requests sent to /users
- ...
-)}
-If there is no api specified in the configuration of the proxy,
-all requests will be marshalled to a single RESTful url (/users) so the serverside
-framework can inspect the HTTP Method and act accordingly:
-
-Method url action
-POST /users create
-GET /users read
-PUT /users/23 update
-DESTROY /users/23 delete
-
- If set to true, a non-phantom record's
-id will be appended to the url. Some MVC (e.g., Ruby on Rails,
-Merb and Django) support segment based urls where the segments in the URL follow the
-Model-View-Controller approach: someSite.com/controller/action/id
-Where the segments in the url are typically:
-- The first segment : represents the controller class that should be invoked.
-- The second segment : represents the class function, or method, that should be called.
-- The third segment : represents the ID (a variable typically passed to the method).
-
+}); | Observable | | onRead : FunctionAbstract method that should be implemented in all subclasses. Note: Should only be used by custom-proxy developers. ... Abstract method that should be implemented in all subclasses. Note: Should only be used by custom-proxy developers. Callback for read action. | DataProxy | | onWrite : FunctionAbstract method that should be implemented in all subclasses. Note: Should only be used by custom-proxy developers. ... Abstract method that should be implemented in all subclasses. Note: Should only be used by custom-proxy developers. Callback for create, update and destroy actions. | DataProxy | | restful : BooleanDefaults to false. Set to true to operate in a RESTful manner.
+ Note: this parameter will automatically be set to tr... Defaults to false. Set to true to operate in a RESTful manner.
+ Note: this parameter will automatically be set to true if the
+Ext.data.Store it is plugged into is set to restful: true . If the
+Store is RESTful, there is no need to set this option on the proxy.
+ RESTful implementations enable the serverside framework to automatically route
+actions sent to one url based upon the HTTP method, for example:
+ store: new Ext.data.Store({
+ restful: true,
+ proxy: new Ext.data.HttpProxy({url:'/users'}); // all requests sent to /users
+ ...
+)}
+If there is no api specified in the configuration of the proxy,
+all requests will be marshalled to a single RESTful url (/users) so the serverside
+framework can inspect the HTTP Method and act accordingly:
+
+Method url action
+POST /users create
+GET /users read
+PUT /users/23 update
+DESTROY /users/23 delete
+
+ If set to true, a non-phantom record's
+id will be appended to the url. Some MVC (e.g., Ruby on Rails,
+Merb and Django) support segment based urls where the segments in the URL follow the
+Model-View-Controller approach: someSite.com/controller/action/id
+Where the segments in the url are typically:
+- The first segment : represents the controller class that should be invoked.
+- The second segment : represents the class function, or method, that should be called.
+- The third segment : represents the ID (a variable typically passed to the method).
+
Refer to Ext.data.DataProxy.api for additional information. | DataProxy |
Public PropertiesThis class has no public properties. Public Methods|
| MemoryProxy( Object data )
| MemoryProxy | | addEvents( Object|String o , string Optional. )
:
@@ -206,47 +209,47 @@ Or a shorthand syntax:
:
voidDestroys the proxy by purging any event listeners and cancelling any active requests. Destroys the proxy by purging any event listeners and cancelling any active requests. | DataProxy | | doRequest( String action , Ext.data.Record/Ext.data.Record[] rs , Object params , Ext.data.DataReader reader , Function callback , Object scope , Object arg )
:
- voidMemoryProxy implementation of DataProxy#doRequest MemoryProxy implementation of DataProxy#doRequest Parameters:action : Stringrs : Ext.data.Record/Ext.data.Record[]If action is load, rs will be null params : ObjectAn object containing properties which are to be used as HTTP parameters
-for the request to the remote server. reader : Ext.data.DataReaderThe Reader object which converts the data
-object into a block of Ext.data.Records. callback : FunctionThe function into which to pass the block of Ext.data.Records.
-The function must be passed
| MemoryProxy | | enableBubble( String/Array events )
:
- voidEnables events fired by this Observable to bubble up an owner hierarchy by calling
-this.getBubbleTarget() if present... Enables events fired by this Observable to bubble up an owner hierarchy by calling
-this.getBubbleTarget() if present. There is no implementation in the Observable base class.
- This is commonly used by Ext.Components to bubble events to owner Containers. See Ext.Component.getBubbleTarget. The default
-implementation in Ext.Component returns the Component's immediate owner. But if a known target is required, this can be overridden to
-access the required target more quickly.
- Example: Ext.override(Ext.form.Field, {
- // Add functionality to Field's initComponent to enable the change event to bubble
- initComponent : Ext.form.Field.prototype.initComponent.createSequence(function() {
- this.enableBubble('change');
- }),
-
- // We know that we want Field's events to bubble directly to the FormPanel.
- getBubbleTarget : function() {
- if (!this.formPanel) {
- this.formPanel = this.findParentByType('form');
- }
- return this.formPanel;
- }
-});
-
-var myForm = new Ext.formPanel({
- title: 'User Details',
- items: [{
- ...
- }],
- listeners: {
- change: function() {
- // Title goes red if form has been modified.
- myForm.header.setStyle('color', 'red');
- }
- }
+ voidEnables events fired by this Observable to bubble up an owner hierarchy by calling
+this.getBubbleTarget() if present.... Enables events fired by this Observable to bubble up an owner hierarchy by calling
+this.getBubbleTarget() if present. There is no implementation in the Observable base class.
+ This is commonly used by Ext.Components to bubble events to owner Containers. See Ext.Component.getBubbleTarget. The default
+implementation in Ext.Component returns the Component's immediate owner. But if a known target is required, this can be overridden to
+access the required target more quickly.
+ Example: Ext.override(Ext.form.Field, {
+ // Add functionality to Field's initComponent to enable the change event to bubble
+ initComponent : Ext.form.Field.prototype.initComponent.createSequence(function() {
+ this.enableBubble('change');
+ }),
+
+ // We know that we want Field's events to bubble directly to the FormPanel.
+ getBubbleTarget : function() {
+ if (!this.formPanel) {
+ this.formPanel = this.findParentByType('form');
+ }
+ return this.formPanel;
+ }
+});
+
+var myForm = new Ext.formPanel({
+ title: 'User Details',
+ items: [{
+ ...
+ }],
+ listeners: {
+ change: function() {
+ // Title goes red if form has been modified.
+ myForm.header.setStyle('color', 'red');
+ }
+ }
});
| Observable | | fireEvent( String eventName , Object... args )
:
Boolean | Observable | | isApiAction( String [Ext.data.Api.CREATE|READ|UPDATE|DESTROY]} )
:
- BooleanReturns true if the specified action is defined as a unique action in the api-config.
-request. If all API-actions a... Returns true if the specified action is defined as a unique action in the api-config.
-request. If all API-actions are routed to unique urls, the xaction parameter is unecessary. However, if no api is defined
-and all Proxy actions are routed to DataProxy#url, the server-side will require the xaction parameter to perform a switch to
+ Boolean Returns true if the specified action is defined as a unique action in the api-config.
+request. If all API-actions ar... Returns true if the specified action is defined as a unique action in the api-config.
+request. If all API-actions are routed to unique urls, the xaction parameter is unecessary. However, if no api is defined
+and all Proxy actions are routed to DataProxy#url, the server-side will require the xaction parameter to perform a switch to
the corresponding code for CRUD action. Parameters:[Ext.data.Api.CREATE|READ|UPDATE|DESTROY]} : Stringaction Returns: | DataProxy | | load( Object params , Object reader , Object callback , Object scope , Object arg )
:
voidDeprecated load method using old method signature. See {@doRequest} for preferred method. Deprecated load method using old method signature. See {@doRequest} for preferred method. Parameters:params : Objectreader : Objectcallback : Objectscope : Objectarg : Object Returns: | DataProxy | | on( String eventName , Function handler , [Object scope ], [Object options ] )
@@ -281,15 +284,15 @@ event... | Observable | | setApi( String/Object api , String/Function url )
:
- voidRedefines the Proxy's API or a single action of an API. Can be called with two method signatures.
-If called with an ... Redefines the Proxy's API or a single action of an API. Can be called with two method signatures.
- If called with an object as the only parameter, the object should redefine the entire API, e.g.: proxy.setApi({
- read : '/users/read',
- create : '/users/create',
- update : '/users/update',
- destroy : '/users/destroy'
-});
- If called with two parameters, the first parameter should be a string specifying the API action to
+ void Redefines the Proxy's API or a single action of an API. Can be called with two method signatures.
+If called with an o... Redefines the Proxy's API or a single action of an API. Can be called with two method signatures.
+ If called with an object as the only parameter, the object should redefine the entire API, e.g.: proxy.setApi({
+ read : '/users/read',
+ create : '/users/create',
+ update : '/users/update',
+ destroy : '/users/destroy'
+});
+ If called with two parameters, the first parameter should be a string specifying the API action to
redefine and the second parameter should be the URL (or function if using DirectProxy) to call for that action, e.g.: proxy.setApi(Ext.data.Api.actions.read, '/users/new_load_url');
Parameters:api : String/ObjectAn API specification object, or the name of an action. url : String/FunctionThe URL (or function if using DirectProxy) to call for the action. Returns: | DataProxy | | suspendEvents( Boolean queueSuspended )
:
voidSuspend the firing of all events. (see resumeEvents) | Observable |
Public Events|
| beforeload :
( DataProxy this , Object params )
Fires before a request to retrieve a data object. Fires before a request to retrieve a data object. Listeners will be called with the following arguments: | DataProxy | | beforewrite :
- ( DataProxy this , String action , Record/Array[Record] rs , Object params )
- Fires before a request is generated for one of the actions Ext.data.Api.actions.create|update|destroy
-In addition to... Fires before a request is generated for one of the actions Ext.data.Api.actions.create|update|destroy
- In addition to being fired through the DataProxy instance that raised the event, this event is also fired
-through the Ext.data.DataProxy class to allow for centralized processing of beforewrite events from all
-DataProxies by attaching a listener to the Ext.data.Proxy class itself. Listeners will be called with the following arguments:this : DataProxyThe proxy for the request action : String[Ext.data.Api.actions.create|update|destroy] rs : Record/Array[Record]The Record(s) to create|update|destroy. params : ObjectThe request params object. Edit params to add parameters to the request.
| DataProxy | | exception :
+ ( DataProxy this , String action , Record/Record[] rs , Object params )
+ Fires before a request is generated for one of the actions Ext.data.Api.actions.create|update|destroy
+In addition to ... Fires before a request is generated for one of the actions Ext.data.Api.actions.create|update|destroy
+ In addition to being fired through the DataProxy instance that raised the event, this event is also fired
+through the Ext.data.DataProxy class to allow for centralized processing of beforewrite events from all
+DataProxies by attaching a listener to the Ext.data.DataProxy class itself. Listeners will be called with the following arguments:this : DataProxyThe proxy for the request action : String[Ext.data.Api.actions.create|update|destroy] rs : Record/Record[]The Record(s) to create|update|destroy. params : ObjectThe request params object. Edit params to add parameters to the request.
| DataProxy | | exception :
( DataProxy this , String type , String action , Object options , Object response , Mixed arg )
- Fires if an exception occurs in the Proxy during a remote request. This event is relayed
-through a corresponding Ext... Fires if an exception occurs in the Proxy during a remote request. This event is relayed
-through a corresponding Ext.data.Store.exception,
-so any Store instance may observe this event.
- In addition to being fired through the DataProxy instance that raised the event, this event is also fired
-through the Ext.data.DataProxy class to allow for centralized processing of exception events from all
-DataProxies by attaching a listener to the Ext.data.Proxy class itself.
- This event can be fired for one of two reasons:
-
-- remote-request failed :
-The server did not return status === 200.
-
-- remote-request succeeded :
-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.
-
-
- This event fires with two different contexts based upon the 2nd
-parameter type [remote|response]. The first four parameters
-are identical between the two contexts -- only the final two parameters
-differ. Listeners will be called with the following arguments: | DataProxy | | load :
( DataProxy this , Object o , Object options )
Fires before the load method's callback is called. Fires before the load method's callback is called. Listeners will be called with the following arguments: | DataProxy | | loadexception :
( Object this , Object arg , Object null , Error e )
- Fires if an exception occurs in the Proxy during data loading. Note that this event is also relayed
-through Ext.data... Fires if an exception occurs in the Proxy during data loading. Note that this event is also relayed
+ Fires if an exception occurs in the Proxy during data loading. Note that this event is also relayed
+through Ext.data.... Fires if an exception occurs in the Proxy during data loading. Note that this event is also relayed
through Ext.data.Store, so you can listen for it directly on any Store instance. Listeners will be called with the following arguments: | MemoryProxy | | write :
- ( DataProxy this , String action , Object data , Object response , Record/Record{} rs , Object options )
- Fires before the request-callback is called
-In addition to being fired through the DataProxy instance that raised th... Fires before the request-callback is called
- In addition to being fired through the DataProxy instance that raised the event, this event is also fired
-through the Ext.data.DataProxy class to allow for centralized processing of write events from all
-DataProxies by attaching a listener to the Ext.data.Proxy class itself. Listeners will be called with the following arguments:this : DataProxyThe proxy that sent the request action : String[Ext.data.Api.actions.create|upate|destroy] data : ObjectThe data object extracted from the server-response response : ObjectThe decoded response from server rs : Record/Record{}The records from Store options : ObjectThe callback's options property as passed to the request function
| DataProxy |
\ No newline at end of file
+ ( DataProxy this , String action , Object data , Object response , Record/Record[] rs , Object options )
+ Fires before the request-callback is called
+In addition to being fired through the DataProxy instance that raised the... Fires before the request-callback is called
+ In addition to being fired through the DataProxy instance that raised the event, this event is also fired
+through the Ext.data.DataProxy class to allow for centralized processing of write events from all
+DataProxies by attaching a listener to the Ext.data.DataProxy class itself. Listeners will be called with the following arguments:this : DataProxyThe proxy that sent the request action : String[Ext.data.Api.actions.create|upate|destroy] data : ObjectThe data object extracted from the server-response response : ObjectThe decoded response from server rs : Record/Record[]The Record(s) from Store options : ObjectThe callback's options property as passed to the request function
| DataProxy |