/ext-4.0.7/docs/source/AbstractStore.html

https://bitbucket.org/srogerf/javascript · HTML · 762 lines · 638 code · 124 blank · 0 comment · 0 complexity · d4a6404b7f392025e6ba4b6ec99e186b MD5 · raw file

  1. <!DOCTYPE html>
  2. <html>
  3. <head>
  4. <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
  5. <title>The source code</title>
  6. <link href="../resources/prettify/prettify.css" type="text/css" rel="stylesheet" />
  7. <script type="text/javascript" src="../resources/prettify/prettify.js"></script>
  8. <style type="text/css">
  9. .highlight { display: block; background-color: #ddd; }
  10. </style>
  11. <script type="text/javascript">
  12. function highlight() {
  13. document.getElementById(location.hash.replace(/#/, "")).className = "highlight";
  14. }
  15. </script>
  16. </head>
  17. <body onload="prettyPrint(); highlight();">
  18. <pre class="prettyprint lang-js"><span id='Ext-data-AbstractStore'>/**
  19. </span> * @author Ed Spencer
  20. *
  21. * AbstractStore is a superclass of {@link Ext.data.Store} and {@link Ext.data.TreeStore}. It's never used directly,
  22. * but offers a set of methods used by both of those subclasses.
  23. *
  24. * We've left it here in the docs for reference purposes, but unless you need to make a whole new type of Store, what
  25. * you're probably looking for is {@link Ext.data.Store}. If you're still interested, here's a brief description of what
  26. * AbstractStore is and is not.
  27. *
  28. * AbstractStore provides the basic configuration for anything that can be considered a Store. It expects to be
  29. * given a {@link Ext.data.Model Model} that represents the type of data in the Store. It also expects to be given a
  30. * {@link Ext.data.proxy.Proxy Proxy} that handles the loading of data into the Store.
  31. *
  32. * AbstractStore provides a few helpful methods such as {@link #load} and {@link #sync}, which load and save data
  33. * respectively, passing the requests through the configured {@link #proxy}. Both built-in Store subclasses add extra
  34. * behavior to each of these functions. Note also that each AbstractStore subclass has its own way of storing data -
  35. * in {@link Ext.data.Store} the data is saved as a flat {@link Ext.util.MixedCollection MixedCollection}, whereas in
  36. * {@link Ext.data.TreeStore TreeStore} we use a {@link Ext.data.Tree} to maintain the data's hierarchy.
  37. *
  38. * The store provides filtering and sorting support. This sorting/filtering can happen on the client side
  39. * or can be completed on the server. This is controlled by the {@link Ext.data.Store#remoteSort remoteSort} and
  40. * {@link Ext.data.Store#remoteFilter remoteFilter} config options. For more information see the {@link #sort} and
  41. * {@link Ext.data.Store#filter filter} methods.
  42. */
  43. Ext.define('Ext.data.AbstractStore', {
  44. requires: ['Ext.util.MixedCollection', 'Ext.data.Operation', 'Ext.util.Filter'],
  45. mixins: {
  46. observable: 'Ext.util.Observable',
  47. sortable: 'Ext.util.Sortable'
  48. },
  49. statics: {
  50. create: function(store){
  51. if (!store.isStore) {
  52. if (!store.type) {
  53. store.type = 'store';
  54. }
  55. store = Ext.createByAlias('store.' + store.type, store);
  56. }
  57. return store;
  58. }
  59. },
  60. remoteSort : false,
  61. remoteFilter: false,
  62. <span id='Ext-data-AbstractStore-cfg-proxy'> /**
  63. </span> * @cfg {String/Ext.data.proxy.Proxy/Object} proxy
  64. * The Proxy to use for this Store. This can be either a string, a config object or a Proxy instance -
  65. * see {@link #setProxy} for details.
  66. */
  67. <span id='Ext-data-AbstractStore-cfg-autoLoad'> /**
  68. </span> * @cfg {Boolean/Object} autoLoad
  69. * If data is not specified, and if autoLoad is true or an Object, this store's load method is automatically called
  70. * after creation. If the value of autoLoad is an Object, this Object will be passed to the store's load method.
  71. * Defaults to false.
  72. */
  73. autoLoad: false,
  74. <span id='Ext-data-AbstractStore-cfg-autoSync'> /**
  75. </span> * @cfg {Boolean} autoSync
  76. * True to automatically sync the Store with its Proxy after every edit to one of its Records. Defaults to false.
  77. */
  78. autoSync: false,
  79. <span id='Ext-data-AbstractStore-property-batchUpdateMode'> /**
  80. </span> * @property {String} batchUpdateMode
  81. * Sets the updating behavior based on batch synchronization. 'operation' (the default) will update the Store's
  82. * internal representation of the data after each operation of the batch has completed, 'complete' will wait until
  83. * the entire batch has been completed before updating the Store's data. 'complete' is a good choice for local
  84. * storage proxies, 'operation' is better for remote proxies, where there is a comparatively high latency.
  85. */
  86. batchUpdateMode: 'operation',
  87. <span id='Ext-data-AbstractStore-property-filterOnLoad'> /**
  88. </span> * @property {Boolean} filterOnLoad
  89. * If true, any filters attached to this Store will be run after loading data, before the datachanged event is fired.
  90. * Defaults to true, ignored if {@link Ext.data.Store#remoteFilter remoteFilter} is true
  91. */
  92. filterOnLoad: true,
  93. <span id='Ext-data-AbstractStore-property-sortOnLoad'> /**
  94. </span> * @property {Boolean} sortOnLoad
  95. * If true, any sorters attached to this Store will be run after loading data, before the datachanged event is fired.
  96. * Defaults to true, igored if {@link Ext.data.Store#remoteSort remoteSort} is true
  97. */
  98. sortOnLoad: true,
  99. <span id='Ext-data-AbstractStore-property-implicitModel'> /**
  100. </span> * @property {Boolean} implicitModel
  101. * True if a model was created implicitly for this Store. This happens if a fields array is passed to the Store's
  102. * constructor instead of a model constructor or name.
  103. * @private
  104. */
  105. implicitModel: false,
  106. <span id='Ext-data-AbstractStore-property-defaultProxyType'> /**
  107. </span> * @property {String} defaultProxyType
  108. * The string type of the Proxy to create if none is specified. This defaults to creating a
  109. * {@link Ext.data.proxy.Memory memory proxy}.
  110. */
  111. defaultProxyType: 'memory',
  112. <span id='Ext-data-AbstractStore-property-isDestroyed'> /**
  113. </span> * @property {Boolean} isDestroyed
  114. * True if the Store has already been destroyed. If this is true, the reference to Store should be deleted
  115. * as it will not function correctly any more.
  116. */
  117. isDestroyed: false,
  118. isStore: true,
  119. <span id='Ext-data-AbstractStore-cfg-storeId'> /**
  120. </span> * @cfg {String} storeId
  121. * Unique identifier for this store. If present, this Store will be registered with the {@link Ext.data.StoreManager},
  122. * making it easy to reuse elsewhere. Defaults to undefined.
  123. */
  124. <span id='Ext-data-AbstractStore-cfg-fields'> /**
  125. </span> * @cfg {Object[]} fields
  126. * This may be used in place of specifying a {@link #model} configuration. The fields should be a
  127. * set of {@link Ext.data.Field} configuration objects. The store will automatically create a {@link Ext.data.Model}
  128. * with these fields. In general this configuration option should be avoided, it exists for the purposes of
  129. * backwards compatibility. For anything more complicated, such as specifying a particular id property or
  130. * assocations, a {@link Ext.data.Model} should be defined and specified for the {@link #model}
  131. * config.
  132. */
  133. <span id='Ext-data-AbstractStore-cfg-model'> /**
  134. </span> * @cfg {String} model
  135. * Name of the {@link Ext.data.Model Model} associated with this store.
  136. * The string is used as an argument for {@link Ext.ModelManager#getModel}.
  137. */
  138. sortRoot: 'data',
  139. //documented above
  140. constructor: function(config) {
  141. var me = this,
  142. filters;
  143. me.addEvents(
  144. <span id='Ext-data-AbstractStore-event-add'> /**
  145. </span> * @event add
  146. * Fired when a Model instance has been added to this Store
  147. * @param {Ext.data.Store} store The store
  148. * @param {Ext.data.Model[]} records The Model instances that were added
  149. * @param {Number} index The index at which the instances were inserted
  150. */
  151. 'add',
  152. <span id='Ext-data-AbstractStore-event-remove'> /**
  153. </span> * @event remove
  154. * Fired when a Model instance has been removed from this Store
  155. * @param {Ext.data.Store} store The Store object
  156. * @param {Ext.data.Model} record The record that was removed
  157. * @param {Number} index The index of the record that was removed
  158. */
  159. 'remove',
  160. <span id='Ext-data-AbstractStore-event-update'> /**
  161. </span> * @event update
  162. * Fires when a Model instance has been updated
  163. * @param {Ext.data.Store} this
  164. * @param {Ext.data.Model} record The Model instance that was updated
  165. * @param {String} operation The update operation being performed. Value may be one of:
  166. *
  167. * Ext.data.Model.EDIT
  168. * Ext.data.Model.REJECT
  169. * Ext.data.Model.COMMIT
  170. */
  171. 'update',
  172. <span id='Ext-data-AbstractStore-event-datachanged'> /**
  173. </span> * @event datachanged
  174. * Fires whenever the records in the Store have changed in some way - this could include adding or removing
  175. * records, or updating the data in existing records
  176. * @param {Ext.data.Store} this The data store
  177. */
  178. 'datachanged',
  179. <span id='Ext-data-AbstractStore-event-beforeload'> /**
  180. </span> * @event beforeload
  181. * Fires before a request is made for a new data object. If the beforeload handler returns false the load
  182. * action will be canceled.
  183. * @param {Ext.data.Store} store This Store
  184. * @param {Ext.data.Operation} operation The Ext.data.Operation object that will be passed to the Proxy to
  185. * load the Store
  186. */
  187. 'beforeload',
  188. <span id='Ext-data-AbstractStore-event-load'> /**
  189. </span> * @event load
  190. * Fires whenever the store reads data from a remote data source.
  191. * @param {Ext.data.Store} this
  192. * @param {Ext.data.Model[]} records An array of records
  193. * @param {Boolean} successful True if the operation was successful.
  194. */
  195. 'load',
  196. <span id='Ext-data-AbstractStore-event-write'> /**
  197. </span> * @event write
  198. * Fires whenever a successful write has been made via the configured {@link #proxy Proxy}
  199. * @param {Ext.data.Store} store This Store
  200. * @param {Ext.data.Operation} operation The {@link Ext.data.Operation Operation} object that was used in
  201. * the write
  202. */
  203. 'write',
  204. <span id='Ext-data-AbstractStore-event-beforesync'> /**
  205. </span> * @event beforesync
  206. * Fired before a call to {@link #sync} is executed. Return false from any listener to cancel the synv
  207. * @param {Object} options Hash of all records to be synchronized, broken down into create, update and destroy
  208. */
  209. 'beforesync',
  210. <span id='Ext-data-AbstractStore-event-clear'> /**
  211. </span> * @event clear
  212. * Fired after the {@link #removeAll} method is called.
  213. * @param {Ext.data.Store} this
  214. */
  215. 'clear'
  216. );
  217. Ext.apply(me, config);
  218. // don't use *config* anymore from here on... use *me* instead...
  219. <span id='Ext-data-AbstractStore-property-removed'> /**
  220. </span> * Temporary cache in which removed model instances are kept until successfully synchronised with a Proxy,
  221. * at which point this is cleared.
  222. * @private
  223. * @property {Ext.data.Model[]} removed
  224. */
  225. me.removed = [];
  226. me.mixins.observable.constructor.apply(me, arguments);
  227. me.model = Ext.ModelManager.getModel(me.model);
  228. <span id='Ext-data-AbstractStore-property-modelDefaults'> /**
  229. </span> * @property {Object} modelDefaults
  230. * @private
  231. * A set of default values to be applied to every model instance added via {@link #insert} or created via {@link #create}.
  232. * This is used internally by associations to set foreign keys and other fields. See the Association classes source code
  233. * for examples. This should not need to be used by application developers.
  234. */
  235. Ext.applyIf(me, {
  236. modelDefaults: {}
  237. });
  238. //Supports the 3.x style of simply passing an array of fields to the store, implicitly creating a model
  239. if (!me.model &amp;&amp; me.fields) {
  240. me.model = Ext.define('Ext.data.Store.ImplicitModel-' + (me.storeId || Ext.id()), {
  241. extend: 'Ext.data.Model',
  242. fields: me.fields,
  243. proxy: me.proxy || me.defaultProxyType
  244. });
  245. delete me.fields;
  246. me.implicitModel = true;
  247. }
  248. // &lt;debug&gt;
  249. if (!me.model) {
  250. if (Ext.isDefined(Ext.global.console)) {
  251. Ext.global.console.warn('Store defined with no model. You may have mistyped the model name.');
  252. }
  253. }
  254. // &lt;/debug&gt;
  255. //ensures that the Proxy is instantiated correctly
  256. me.setProxy(me.proxy || me.model.getProxy());
  257. if (me.id &amp;&amp; !me.storeId) {
  258. me.storeId = me.id;
  259. delete me.id;
  260. }
  261. if (me.storeId) {
  262. Ext.data.StoreManager.register(me);
  263. }
  264. me.mixins.sortable.initSortable.call(me);
  265. <span id='Ext-data-AbstractStore-property-filters'> /**
  266. </span> * @property {Ext.util.MixedCollection} filters
  267. * The collection of {@link Ext.util.Filter Filters} currently applied to this Store
  268. */
  269. filters = me.decodeFilters(me.filters);
  270. me.filters = Ext.create('Ext.util.MixedCollection');
  271. me.filters.addAll(filters);
  272. },
  273. <span id='Ext-data-AbstractStore-method-setProxy'> /**
  274. </span> * Sets the Store's Proxy by string, config object or Proxy instance
  275. * @param {String/Object/Ext.data.proxy.Proxy} proxy The new Proxy, which can be either a type string, a configuration object
  276. * or an Ext.data.proxy.Proxy instance
  277. * @return {Ext.data.proxy.Proxy} The attached Proxy object
  278. */
  279. setProxy: function(proxy) {
  280. var me = this;
  281. if (proxy instanceof Ext.data.proxy.Proxy) {
  282. proxy.setModel(me.model);
  283. } else {
  284. if (Ext.isString(proxy)) {
  285. proxy = {
  286. type: proxy
  287. };
  288. }
  289. Ext.applyIf(proxy, {
  290. model: me.model
  291. });
  292. proxy = Ext.createByAlias('proxy.' + proxy.type, proxy);
  293. }
  294. me.proxy = proxy;
  295. return me.proxy;
  296. },
  297. <span id='Ext-data-AbstractStore-method-getProxy'> /**
  298. </span> * Returns the proxy currently attached to this proxy instance
  299. * @return {Ext.data.proxy.Proxy} The Proxy instance
  300. */
  301. getProxy: function() {
  302. return this.proxy;
  303. },
  304. //saves any phantom records
  305. create: function(data, options) {
  306. var me = this,
  307. instance = Ext.ModelManager.create(Ext.applyIf(data, me.modelDefaults), me.model.modelName),
  308. operation;
  309. options = options || {};
  310. Ext.applyIf(options, {
  311. action : 'create',
  312. records: [instance]
  313. });
  314. operation = Ext.create('Ext.data.Operation', options);
  315. me.proxy.create(operation, me.onProxyWrite, me);
  316. return instance;
  317. },
  318. read: function() {
  319. return this.load.apply(this, arguments);
  320. },
  321. onProxyRead: Ext.emptyFn,
  322. update: function(options) {
  323. var me = this,
  324. operation;
  325. options = options || {};
  326. Ext.applyIf(options, {
  327. action : 'update',
  328. records: me.getUpdatedRecords()
  329. });
  330. operation = Ext.create('Ext.data.Operation', options);
  331. return me.proxy.update(operation, me.onProxyWrite, me);
  332. },
  333. <span id='Ext-data-AbstractStore-method-onProxyWrite'> /**
  334. </span> * @private
  335. * Callback for any write Operation over the Proxy. Updates the Store's MixedCollection to reflect
  336. * the updates provided by the Proxy
  337. */
  338. onProxyWrite: function(operation) {
  339. var me = this,
  340. success = operation.wasSuccessful(),
  341. records = operation.getRecords();
  342. switch (operation.action) {
  343. case 'create':
  344. me.onCreateRecords(records, operation, success);
  345. break;
  346. case 'update':
  347. me.onUpdateRecords(records, operation, success);
  348. break;
  349. case 'destroy':
  350. me.onDestroyRecords(records, operation, success);
  351. break;
  352. }
  353. if (success) {
  354. me.fireEvent('write', me, operation);
  355. me.fireEvent('datachanged', me);
  356. }
  357. //this is a callback that would have been passed to the 'create', 'update' or 'destroy' function and is optional
  358. Ext.callback(operation.callback, operation.scope || me, [records, operation, success]);
  359. },
  360. //tells the attached proxy to destroy the given records
  361. destroy: function(options) {
  362. var me = this,
  363. operation;
  364. options = options || {};
  365. Ext.applyIf(options, {
  366. action : 'destroy',
  367. records: me.getRemovedRecords()
  368. });
  369. operation = Ext.create('Ext.data.Operation', options);
  370. return me.proxy.destroy(operation, me.onProxyWrite, me);
  371. },
  372. <span id='Ext-data-AbstractStore-method-onBatchOperationComplete'> /**
  373. </span> * @private
  374. * Attached as the 'operationcomplete' event listener to a proxy's Batch object. By default just calls through
  375. * to onProxyWrite.
  376. */
  377. onBatchOperationComplete: function(batch, operation) {
  378. return this.onProxyWrite(operation);
  379. },
  380. <span id='Ext-data-AbstractStore-method-onBatchComplete'> /**
  381. </span> * @private
  382. * Attached as the 'complete' event listener to a proxy's Batch object. Iterates over the batch operations
  383. * and updates the Store's internal data MixedCollection.
  384. */
  385. onBatchComplete: function(batch, operation) {
  386. var me = this,
  387. operations = batch.operations,
  388. length = operations.length,
  389. i;
  390. me.suspendEvents();
  391. for (i = 0; i &lt; length; i++) {
  392. me.onProxyWrite(operations[i]);
  393. }
  394. me.resumeEvents();
  395. me.fireEvent('datachanged', me);
  396. },
  397. onBatchException: function(batch, operation) {
  398. // //decide what to do... could continue with the next operation
  399. // batch.start();
  400. //
  401. // //or retry the last operation
  402. // batch.retry();
  403. },
  404. <span id='Ext-data-AbstractStore-method-filterNew'> /**
  405. </span> * @private
  406. * Filter function for new records.
  407. */
  408. filterNew: function(item) {
  409. // only want phantom records that are valid
  410. return item.phantom === true &amp;&amp; item.isValid();
  411. },
  412. <span id='Ext-data-AbstractStore-method-getNewRecords'> /**
  413. </span> * Returns all Model instances that are either currently a phantom (e.g. have no id), or have an ID but have not
  414. * yet been saved on this Store (this happens when adding a non-phantom record from another Store into this one)
  415. * @return {Ext.data.Model[]} The Model instances
  416. */
  417. getNewRecords: function() {
  418. return [];
  419. },
  420. <span id='Ext-data-AbstractStore-method-getUpdatedRecords'> /**
  421. </span> * Returns all Model instances that have been updated in the Store but not yet synchronized with the Proxy
  422. * @return {Ext.data.Model[]} The updated Model instances
  423. */
  424. getUpdatedRecords: function() {
  425. return [];
  426. },
  427. <span id='Ext-data-AbstractStore-method-filterUpdated'> /**
  428. </span> * @private
  429. * Filter function for updated records.
  430. */
  431. filterUpdated: function(item) {
  432. // only want dirty records, not phantoms that are valid
  433. return item.dirty === true &amp;&amp; item.phantom !== true &amp;&amp; item.isValid();
  434. },
  435. <span id='Ext-data-AbstractStore-method-getRemovedRecords'> /**
  436. </span> * Returns any records that have been removed from the store but not yet destroyed on the proxy.
  437. * @return {Ext.data.Model[]} The removed Model instances
  438. */
  439. getRemovedRecords: function() {
  440. return this.removed;
  441. },
  442. filter: function(filters, value) {
  443. },
  444. <span id='Ext-data-AbstractStore-method-decodeFilters'> /**
  445. </span> * @private
  446. * Normalizes an array of filter objects, ensuring that they are all Ext.util.Filter instances
  447. * @param {Object[]} filters The filters array
  448. * @return {Ext.util.Filter[]} Array of Ext.util.Filter objects
  449. */
  450. decodeFilters: function(filters) {
  451. if (!Ext.isArray(filters)) {
  452. if (filters === undefined) {
  453. filters = [];
  454. } else {
  455. filters = [filters];
  456. }
  457. }
  458. var length = filters.length,
  459. Filter = Ext.util.Filter,
  460. config, i;
  461. for (i = 0; i &lt; length; i++) {
  462. config = filters[i];
  463. if (!(config instanceof Filter)) {
  464. Ext.apply(config, {
  465. root: 'data'
  466. });
  467. //support for 3.x style filters where a function can be defined as 'fn'
  468. if (config.fn) {
  469. config.filterFn = config.fn;
  470. }
  471. //support a function to be passed as a filter definition
  472. if (typeof config == 'function') {
  473. config = {
  474. filterFn: config
  475. };
  476. }
  477. filters[i] = new Filter(config);
  478. }
  479. }
  480. return filters;
  481. },
  482. clearFilter: function(supressEvent) {
  483. },
  484. isFiltered: function() {
  485. },
  486. filterBy: function(fn, scope) {
  487. },
  488. <span id='Ext-data-AbstractStore-method-sync'> /**
  489. </span> * Synchronizes the Store with its Proxy. This asks the Proxy to batch together any new, updated
  490. * and deleted records in the store, updating the Store's internal representation of the records
  491. * as each operation completes.
  492. */
  493. sync: function() {
  494. var me = this,
  495. options = {},
  496. toCreate = me.getNewRecords(),
  497. toUpdate = me.getUpdatedRecords(),
  498. toDestroy = me.getRemovedRecords(),
  499. needsSync = false;
  500. if (toCreate.length &gt; 0) {
  501. options.create = toCreate;
  502. needsSync = true;
  503. }
  504. if (toUpdate.length &gt; 0) {
  505. options.update = toUpdate;
  506. needsSync = true;
  507. }
  508. if (toDestroy.length &gt; 0) {
  509. options.destroy = toDestroy;
  510. needsSync = true;
  511. }
  512. if (needsSync &amp;&amp; me.fireEvent('beforesync', options) !== false) {
  513. me.proxy.batch(options, me.getBatchListeners());
  514. }
  515. },
  516. <span id='Ext-data-AbstractStore-method-getBatchListeners'> /**
  517. </span> * @private
  518. * Returns an object which is passed in as the listeners argument to proxy.batch inside this.sync.
  519. * This is broken out into a separate function to allow for customisation of the listeners
  520. * @return {Object} The listeners object
  521. */
  522. getBatchListeners: function() {
  523. var me = this,
  524. listeners = {
  525. scope: me,
  526. exception: me.onBatchException
  527. };
  528. if (me.batchUpdateMode == 'operation') {
  529. listeners.operationcomplete = me.onBatchOperationComplete;
  530. } else {
  531. listeners.complete = me.onBatchComplete;
  532. }
  533. return listeners;
  534. },
  535. //deprecated, will be removed in 5.0
  536. save: function() {
  537. return this.sync.apply(this, arguments);
  538. },
  539. <span id='Ext-data-AbstractStore-method-load'> /**
  540. </span> * Loads the Store using its configured {@link #proxy}.
  541. * @param {Object} options (optional) config object. This is passed into the {@link Ext.data.Operation Operation}
  542. * object that is created and then sent to the proxy's {@link Ext.data.proxy.Proxy#read} function
  543. */
  544. load: function(options) {
  545. var me = this,
  546. operation;
  547. options = options || {};
  548. Ext.applyIf(options, {
  549. action : 'read',
  550. filters: me.filters.items,
  551. sorters: me.getSorters()
  552. });
  553. operation = Ext.create('Ext.data.Operation', options);
  554. if (me.fireEvent('beforeload', me, operation) !== false) {
  555. me.loading = true;
  556. me.proxy.read(operation, me.onProxyLoad, me);
  557. }
  558. return me;
  559. },
  560. <span id='Ext-data-AbstractStore-method-afterEdit'> /**
  561. </span> * @private
  562. * A model instance should call this method on the Store it has been {@link Ext.data.Model#join joined} to.
  563. * @param {Ext.data.Model} record The model instance that was edited
  564. */
  565. afterEdit : function(record) {
  566. var me = this;
  567. if (me.autoSync) {
  568. me.sync();
  569. }
  570. me.fireEvent('update', me, record, Ext.data.Model.EDIT);
  571. },
  572. <span id='Ext-data-AbstractStore-method-afterReject'> /**
  573. </span> * @private
  574. * A model instance should call this method on the Store it has been {@link Ext.data.Model#join joined} to..
  575. * @param {Ext.data.Model} record The model instance that was edited
  576. */
  577. afterReject : function(record) {
  578. this.fireEvent('update', this, record, Ext.data.Model.REJECT);
  579. },
  580. <span id='Ext-data-AbstractStore-method-afterCommit'> /**
  581. </span> * @private
  582. * A model instance should call this method on the Store it has been {@link Ext.data.Model#join joined} to.
  583. * @param {Ext.data.Model} record The model instance that was edited
  584. */
  585. afterCommit : function(record) {
  586. this.fireEvent('update', this, record, Ext.data.Model.COMMIT);
  587. },
  588. clearData: Ext.emptyFn,
  589. destroyStore: function() {
  590. var me = this;
  591. if (!me.isDestroyed) {
  592. if (me.storeId) {
  593. Ext.data.StoreManager.unregister(me);
  594. }
  595. me.clearData();
  596. me.data = null;
  597. me.tree = null;
  598. // Ext.destroy(this.proxy);
  599. me.reader = me.writer = null;
  600. me.clearListeners();
  601. me.isDestroyed = true;
  602. if (me.implicitModel) {
  603. Ext.destroy(me.model);
  604. }
  605. }
  606. },
  607. doSort: function(sorterFn) {
  608. var me = this;
  609. if (me.remoteSort) {
  610. //the load function will pick up the new sorters and request the sorted data from the proxy
  611. me.load();
  612. } else {
  613. me.data.sortBy(sorterFn);
  614. me.fireEvent('datachanged', me);
  615. }
  616. },
  617. getCount: Ext.emptyFn,
  618. getById: Ext.emptyFn,
  619. <span id='Ext-data-AbstractStore-method-removeAll'> /**
  620. </span> * Removes all records from the store. This method does a &quot;fast remove&quot;,
  621. * individual remove events are not called. The {@link #clear} event is
  622. * fired upon completion.
  623. * @method
  624. */
  625. removeAll: Ext.emptyFn,
  626. // individual substores should implement a &quot;fast&quot; remove
  627. // and fire a clear event afterwards
  628. <span id='Ext-data-AbstractStore-method-isLoading'> /**
  629. </span> * Returns true if the Store is currently performing a load operation
  630. * @return {Boolean} True if the Store is currently loading
  631. */
  632. isLoading: function() {
  633. return !!this.loading;
  634. }
  635. });
  636. </pre>
  637. </body>
  638. </html>