/* This file is part of Ext JS 3.4 Copyright (c) 2011-2013 Sencha Inc Contact: http://www.sencha.com/contact GNU General Public License Usage This file may be used under the terms of the GNU General Public License version 3.0 as published by the Free Software Foundation and appearing in the file LICENSE included in the packaging of this file. Please review the following information to ensure the GNU General Public License version 3.0 requirements will be met: http://www.gnu.org/copyleft/gpl.html. If you are unsure which license is appropriate for your use, please contact the sales department at http://www.sencha.com/contact. Build date: 2013-04-03 15:07:25 */ Ext.data.JsonP.Ext_data_MemoryProxy({"alternateClassNames":[],"aliases":{},"enum":null,"parentMixins":[],"tagname":"class","subclasses":[],"extends":"Ext.data.DataProxy","uses":[],"html":"
Hierarchy
Ext.util.ObservableExt.data.DataProxyExt.data.MemoryProxyFiles
An implementation of Ext.data.DataProxy that simply passes the data specified in its constructor\nto the Reader when its load method is called.
\nSpecific urls to call on CRUD action methods \"read\", \"create\", \"update\" and \"destroy\".\nDefaults to:
\n\napi: {\n read : undefined,\n create : undefined,\n update : undefined,\n destroy : undefined\n}\n
\n\n\nThe url is built based upon the action being executed [load|create|save|destroy]\nusing the commensurate api property, or if undefined default to the\nconfigured Ext.data.Store.url.
\n\n\nFor example:
\n\n\napi: {\n load : '/controller/load',\n create : '/controller/new', // Server MUST return idProperty of new record\n save : '/controller/update',\n destroy : '/controller/destroy_action'\n}\n\n// Alternatively, one can use the object-form to specify each API-action\napi: {\n load: {url: 'read.php', method: 'GET'},\n create: 'create.php',\n destroy: 'destroy.php',\n save: 'update.php'\n}\n
\n\n\nIf the specific URL for a given CRUD action is undefined, the CRUD action request\nwill be directed to the configured url.
\n\n\nNote: To modify the URL for an action dynamically the appropriate API\n\n\n
property should be modified before the action is requested using the corresponding before\naction event. For example to modify the URL associated with the load action:
\n\n// modify the url for the action\nmyStore.on({\n beforeload: {\n fn: function (store, options) {\n // use setUrl to change the URL for *just* this request.\n store.proxy.setUrl('changed1.php');\n\n // set optional second parameter to true to make this URL change\n // permanent, applying this URL for all subsequent requests.\n store.proxy.setUrl('changed1.php', true);\n\n // Altering the proxy API should be done using the public\n // method setApi.\n store.proxy.setApi('read', 'changed2.php');\n\n // Or set the entire API with a config-object.\n // When using the config-object option, you must redefine the entire\n // API -- not just a specific action of it.\n store.proxy.setApi({\n read : 'changed_read.php',\n create : 'changed_create.php',\n update : 'changed_update.php',\n destroy : 'changed_destroy.php'\n });\n }\n }\n});\n
\n\n\n\nAbstract method that should be implemented in all subclasses. Note: Should only be used by custom-proxy developers.\n(e.g.: HttpProxy.doRequest,\nDirectProxy.doRequest).
\n(optional)
A config object containing one or more event handlers to be added to this\nobject during initialization. This should be a valid listeners config object as specified in the\naddListener example for attaching multiple handlers at once.
\n\nDOM events from ExtJs Components
\n\n\nWhile some ExtJs Component classes export selected DOM events (e.g. \"click\", \"mouseover\" etc), this\n\n\n
is usually only done when extra value can be added. For example the DataView's\nclick
event passing the node clicked on. To access DOM\nevents directly from a Component's HTMLElement, listeners must be added to the Element after the Component\nhas been rendered. A plugin can simplify this step:
// Plugin is configured with a listeners config object.\n// The Component is appended to the argument list of all handler functions.\nExt.DomObserver = Ext.extend(Object, {\n constructor: function(config) {\n this.listeners = config.listeners ? config.listeners : config;\n },\n\n // Component passes itself into plugin's init method\n init: function(c) {\n var p, l = this.listeners;\n for (p in l) {\n if (Ext.isFunction(l[p])) {\n l[p] = this.createHandler(l[p], c);\n } else {\n l[p].fn = this.createHandler(l[p].fn, c);\n }\n }\n\n // Add the listeners to the Element immediately following the render call\n c.render = c.render.createSequence(function() {\n var e = c.getEl();\n if (e) {\n e.on(l);\n }\n });\n },\n\n createHandler: function(fn, c) {\n return function(e) {\n fn.call(this, e, c);\n };\n }\n});\n\nvar combo = new Ext.form.ComboBox({\n\n // Collapse combo when its element is clicked on\n plugins: [ new Ext.DomObserver({\n click: function(evt, comp) {\n comp.collapse();\n }\n })],\n store: myStore,\n typeAhead: true,\n mode: 'local',\n triggerAction: 'all'\n});\n
\n\n\n\nAbstract method that should be implemented in all subclasses. Note: Should only be used by custom-proxy developers. Callback for read action.
\nAbstract method that should be implemented in all subclasses. Note: Should only be used by custom-proxy developers. Callback for create, update and destroy actions.
\nDefaults to false. Set to true to operate in a RESTful manner.
\n\n\nNote: this parameter will automatically be set to true if the\n\n\n
Ext.data.Store it is plugged into is set to restful: true
. If the\nStore is RESTful, there is no need to set this option on the proxy.
RESTful implementations enable the serverside framework to automatically route\n\n\n
actions sent to one url based upon the HTTP method, for example:
\n\nstore: new Ext.data.Store({\n restful: true,\n proxy: new Ext.data.HttpProxy({url:'/users'}); // all requests sent to /users\n ...\n)}\n
\n\n\nIf there is no api
specified in the configuration of the proxy,\nall requests will be marshalled to a single RESTful url (/users) so the serverside\nframework can inspect the HTTP Method and act accordingly:
Method url action\nPOST /users create\nGET /users read\nPUT /users/23 update\nDESTROY /users/23 delete\n\n\n\n\n\n
If set to true, a non-phantom record's\nid will be appended to the url. Some MVC (e.g., Ruby on Rails,\nMerb and Django) support segment based urls where the segments in the URL follow the\nModel-View-Controller approach:\n
someSite.com/controller/action/id\n
\nWhere the segments in the url are typically:Refer to api
for additional information.
Defaults to: false
The data object which the Reader uses to construct a block of Ext.data.Records.
\nAdds the specified events to the list of events which this Observable may fire.
\nEither an object with event names as properties with a value of true
\nor the first event name string if multiple event names are being passed as separate parameters.
. Event name if multiple event names are being passed as separate parameters.\nUsage:
\n\nthis.addEvents('storeloaded', 'storecleared');\n
\n\nAppends an event handler to this object.
\nThe name of the event to listen for.
\nThe method the event invokes.
\nThe scope (this
reference) in which the handler function is executed.\nIf omitted, defaults to the object which fired the event.
An object containing handler configuration.\nproperties. This may contain any of the following properties:
this
reference) in which the handler function is executed.\nIf omitted, defaults to the object which fired the event.\nCombining Options
\nUsing the options argument, it is possible to combine different types of listeners:
\n
\nA delayed, one-time listener.\n
myDataView.on('click', this.onClick, this, {\nsingle: true,\ndelay: 100\n});
\n\nAttaching multiple handlers in 1 call
\nThe method also allows for a single argument to be passed which is a config object containing properties\nwhich specify multiple handlers.\n
\n
myGridPanel.on({\n'click' : {\n fn: this.onClick,\n scope: this,\n delay: 100\n},\n'mouseover' : {\n fn: this.onMouseOver,\n scope: this\n},\n'mouseout' : {\n fn: this.onMouseOut,\n scope: this\n}\n});
\n\nOr a shorthand syntax:
\n
myGridPanel.on({\n'click' : this.onClick,\n'mouseover' : this.onMouseOver,\n'mouseout' : this.onMouseOut,\n scope: this\n});
\n\nbuildUrl\nSets the appropriate url based upon the action being executed. If restful is true, and only a single record is being acted upon,\nurl will be built Rails-style, as in \"/controller/action/32\". restful will aply iff the supplied record is an\ninstance of Ext.data.Record rather than an Array of them.
\nThe api action being executed [read|create|update|destroy]
\nThe record or Array of Records being acted upon.
\nurl
\nDestroys the proxy by purging any event listeners and cancelling any active requests.
\nMemoryProxy implementation of DataProxy#doRequest
\nIf action is load, rs will be null
\nAn object containing properties which are to be used as HTTP parameters\nfor the request to the remote server.
\nThe Reader object which converts the data\nobject into a block of Ext.data.Records.
\nThe function into which to pass the block of Ext.data.Records.\nThe function must be passed
The scope (this
reference) in which the callback function is executed. Defaults to the browser window.
An optional argument which is passed to the callback as its second parameter.
\nEnables events fired by this Observable to bubble up an owner hierarchy by calling\nthis.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\nimplementation in Ext.Component returns the Component's immediate owner. But if a known target is required, this can be overridden to\naccess the required target more quickly.
\n\n\nExample:
\n\n\nExt.override(Ext.form.Field, {\n // Add functionality to Field's initComponent to enable the change event to bubble\n initComponent : Ext.form.Field.prototype.initComponent.createSequence(function() {\n this.enableBubble('change');\n }),\n\n // We know that we want Field's events to bubble directly to the FormPanel.\n getBubbleTarget : function() {\n if (!this.formPanel) {\n this.formPanel = this.findParentByType('form');\n }\n return this.formPanel;\n }\n});\n\nvar myForm = new Ext.formPanel({\n title: 'User Details',\n items: [{\n ...\n }],\n listeners: {\n change: function() {\n // Title goes red if form has been modified.\n myForm.header.setStyle('color', 'red');\n }\n }\n});\n
\n\nFires the specified event with the passed parameters (minus the event name).
\n\n\nAn event may be set to bubble up an Observable parent hierarchy (See Ext.Component.getBubbleTarget)\nby calling enableBubble.
\n\nThe name of the event to fire.
\nVariable number of parameters are passed to handlers.
\nreturns false if any of the handlers return false otherwise it returns true.
\nChecks to see if this object has any listeners for a specified event
\nThe name of the event to check for
\nTrue if the event is being listened for, else false
\nReturns true if the specified action is defined as a unique action in the api-config.\nrequest. If all API-actions are routed to unique urls, the xaction parameter is unecessary. However, if no api is defined\nand all Proxy actions are routed to DataProxy#url, the server-side will require the xaction parameter to perform a switch to\nthe corresponding code for CRUD action.
\nCREATE READ UPDATE or DESTROY
\nDeprecated load method using old method signature. See {@doRequest} for preferred method.
\nThis method has been deprecated
\n \n\nAppends an event handler to this object (shorthand for addListener.)
\nThe type of event to listen for
\nThe method the event invokes
\nThe scope (this
reference) in which the handler function is executed.\nIf omitted, defaults to the object which fired the event.
An object containing handler configuration.
\nRelays selected events from the specified Observable as if the events were fired by this.
\nThe Observable whose events this object is to relay.
\nArray of event names to relay.
\nRemoves an event handler.
\nThe type of event the handler was associated with.
\nThe handler to remove. This must be a reference to the function passed into the addListener call.
\nThe scope originally specified for the handler.
\nAll proxy actions are executed through this method. Automatically fires the \"before\" + action event
\nName of the action
\nWill be null when action is 'load'
\nThe scope (this
reference) in which the callback function is executed. Defaults to the Proxy object.
Any options specified for the action (e.g. see Ext.data.Store.load.
\nResume firing events. (see suspendEvents)\nIf events were suspended using the queueSuspended parameter, then all\nevents fired during event suspension will be sent to any listeners now.
\nRedefines the Proxy's API or a single action of an API. Can be called with two method signatures.
\n\n\nIf called with an object as the only parameter, the object should redefine the entire API, e.g.:
\n\n\nproxy.setApi({\n read : '/users/read',\n create : '/users/create',\n update : '/users/update',\n destroy : '/users/destroy'\n});\n
\n\n\nIf called with two parameters, the first parameter should be a string specifying the API action to\nredefine and the second parameter should be the URL (or function if using DirectProxy) to call for that action, e.g.:
\n\n\nproxy.setApi(Ext.data.Api.actions.read, '/users/new_load_url');\n
\n\nSuspend the firing of all events. (see resumeEvents)
\nPass as true to queue up suspended events to be fired\nafter the resumeEvents call instead of discarding all suspended events;
\nRemoves an event handler (shorthand for removeListener.)
\nThe type of event the handler was associated with.
\nThe handler to remove. This must be a reference to the function passed into the addListener call.
\nThe scope originally specified for the handler.
\nFires before a request to retrieve a data object.
\nThe proxy for the request
\nThe params object passed to the request function
\nFires before a request is generated for one of the actions Ext.data.Api.actions.create|update|destroy
\n\n\nIn addition to being fired through the DataProxy instance that raised the event, this event is also fired\nthrough the Ext.data.DataProxy class to allow for centralized processing of beforewrite events from all\nDataProxies by attaching a listener to the Ext.data.DataProxy class itself.
\n\nThe proxy for the request
\n[Ext.data.Api.actions.create|update|destroy]
\nThe Record(s) to create|update|destroy.
\nThe request params
object. Edit params
to add parameters to the request.
Fires if an exception occurs in the Proxy during a remote request. This event is relayed\nthrough a corresponding Ext.data.Store.exception,\nso any Store instance may observe this event.
\n\n\nIn addition to being fired through the DataProxy instance that raised the event, this event is also fired\nthrough the Ext.data.DataProxy class to allow for centralized processing of exception events from all\nDataProxies by attaching a listener to the Ext.data.DataProxy class itself.
\n\n\nThis event can be fired for one of two reasons:
\n\n\nThis event fires with two different contexts based upon the 2nd\n\n\n
parameter type [remote|response]. The first four parameters\nare identical between the two contexts -- only the final two parameters\ndiffer.
\nThe proxy that sent the request
\nThe value of this parameter will be either 'response' or 'remote'.
\n\n\nAn invalid response from the server was returned: either 404,\n500 or the response meta-data does not match that defined in the DataReader\n(e.g.: root, idProperty, successProperty).
\nA valid response was returned from the server having\nsuccessProperty === false. This response might contain an error-message\nsent from the server. For example, the user may have failed\nauthentication/authorization or a database validation error occurred.
\nName of the action (see Ext.data.Api.actions.
\nThe options for the action that were specified in the request.
\nThe value of this parameter depends on the value of the type
parameter:
The raw browser response object (e.g.: XMLHttpRequest)
\nThe decoded response object sent from the server.
\nThe type and value of this parameter depends on the value of the type
parameter:
The JavaScript Error object caught if the configured Reader could not read the data.\nIf the remote request returns success===false, this parameter will be null.
\nThis parameter will only exist if the action was a write action\n(Ext.data.Api.actions.create|update|destroy).
\nFires before the load method's callback is called.
\nThe proxy for the request
\nThe request transaction object
\nThe callback's options property as passed to the request function
\nFires if an exception occurs in the Proxy during data loading. Note that this event is also relayed\nthrough Ext.data.Store, so you can listen for it directly on any Store instance.
\nThe callback's arg object passed to the load function
\nThis parameter does not apply and will always be null for MemoryProxy
\nThe JavaScript Error object caught if the configured Reader could not read the data
\nOverrides: Ext.data.DataProxy.loadexception
Fires before the request-callback is called
\n\n\nIn addition to being fired through the DataProxy instance that raised the event, this event is also fired\nthrough the Ext.data.DataProxy class to allow for centralized processing of write events from all\nDataProxies by attaching a listener to the Ext.data.DataProxy class itself.
\n\nThe proxy that sent the request
\n[Ext.data.Api.actions.create|upate|destroy]
\nThe data object extracted from the server-response
\nThe decoded response from server
\nThe Record(s) from Store
\nThe callback's options property as passed to the request function
\n