You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

68 lines
3.5 KiB

2 years ago
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
  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-DirectStore-method-constructor'><span id='Ext-data-DirectStore'>/**
  19. </span></span> * @class Ext.data.DirectStore
  20. * @extends Ext.data.Store
  21. * &lt;p&gt;Small helper class to create an {@link Ext.data.Store} configured with an
  22. * {@link Ext.data.DirectProxy} and {@link Ext.data.JsonReader} to make interacting
  23. * with an {@link Ext.Direct} Server-side {@link Ext.direct.Provider Provider} easier.
  24. * To create a different proxy/reader combination create a basic {@link Ext.data.Store}
  25. * configured as needed.&lt;/p&gt;
  26. *
  27. * &lt;p&gt;&lt;b&gt;*Note:&lt;/b&gt; Although they are not listed, this class inherits all of the config options of:&lt;/p&gt;
  28. * &lt;div&gt;&lt;ul class=&quot;mdetail-params&quot;&gt;
  29. * &lt;li&gt;&lt;b&gt;{@link Ext.data.Store Store}&lt;/b&gt;&lt;/li&gt;
  30. * &lt;div class=&quot;sub-desc&quot;&gt;&lt;ul class=&quot;mdetail-params&quot;&gt;
  31. *
  32. * &lt;/ul&gt;&lt;/div&gt;
  33. * &lt;li&gt;&lt;b&gt;{@link Ext.data.JsonReader JsonReader}&lt;/b&gt;&lt;/li&gt;
  34. * &lt;div class=&quot;sub-desc&quot;&gt;&lt;ul class=&quot;mdetail-params&quot;&gt;
  35. * &lt;li&gt;&lt;tt&gt;&lt;b&gt;{@link Ext.data.JsonReader#root root}&lt;/b&gt;&lt;/tt&gt;&lt;/li&gt;
  36. * &lt;li&gt;&lt;tt&gt;&lt;b&gt;{@link Ext.data.JsonReader#idProperty idProperty}&lt;/b&gt;&lt;/tt&gt;&lt;/li&gt;
  37. * &lt;li&gt;&lt;tt&gt;&lt;b&gt;{@link Ext.data.JsonReader#totalProperty totalProperty}&lt;/b&gt;&lt;/tt&gt;&lt;/li&gt;
  38. * &lt;/ul&gt;&lt;/div&gt;
  39. *
  40. * &lt;li&gt;&lt;b&gt;{@link Ext.data.DirectProxy DirectProxy}&lt;/b&gt;&lt;/li&gt;
  41. * &lt;div class=&quot;sub-desc&quot;&gt;&lt;ul class=&quot;mdetail-params&quot;&gt;
  42. * &lt;li&gt;&lt;tt&gt;&lt;b&gt;{@link Ext.data.DirectProxy#directFn directFn}&lt;/b&gt;&lt;/tt&gt;&lt;/li&gt;
  43. * &lt;li&gt;&lt;tt&gt;&lt;b&gt;{@link Ext.data.DirectProxy#paramOrder paramOrder}&lt;/b&gt;&lt;/tt&gt;&lt;/li&gt;
  44. * &lt;li&gt;&lt;tt&gt;&lt;b&gt;{@link Ext.data.DirectProxy#paramsAsHash paramsAsHash}&lt;/b&gt;&lt;/tt&gt;&lt;/li&gt;
  45. * &lt;/ul&gt;&lt;/div&gt;
  46. * &lt;/ul&gt;&lt;/div&gt;
  47. *
  48. * @xtype directstore
  49. *
  50. * @constructor
  51. * @param {Object} config
  52. */
  53. Ext.data.DirectStore = Ext.extend(Ext.data.Store, {
  54. constructor : function(config){
  55. // each transaction upon a singe record will generate a distinct Direct transaction since Direct queues them into one Ajax request.
  56. var c = Ext.apply({}, {
  57. batchTransactions: false
  58. }, config);
  59. Ext.data.DirectStore.superclass.constructor.call(this, Ext.apply(c, {
  60. proxy: Ext.isDefined(c.proxy) ? c.proxy : new Ext.data.DirectProxy(Ext.copyTo({}, c, 'paramOrder,paramsAsHash,directFn,api')),
  61. reader: (!Ext.isDefined(c.reader) &amp;&amp; c.fields) ? new Ext.data.JsonReader(Ext.copyTo({}, c, 'totalProperty,root,idProperty'), c.fields) : c.reader
  62. }));
  63. }
  64. });
  65. Ext.reg('directstore', Ext.data.DirectStore);
  66. </pre>
  67. </body>
  68. </html>