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.

62 lines
2.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-JsonStore-method-constructor'><span id='Ext-data-JsonStore'>/**
  19. </span></span> * @class Ext.data.JsonStore
  20. * @extends Ext.data.Store
  21. * &lt;p&gt;Small helper class to make creating {@link Ext.data.Store}s from JSON data easier.
  22. * A JsonStore will be automatically configured with a {@link Ext.data.JsonReader}.&lt;/p&gt;
  23. * &lt;p&gt;A store configuration would be something like:&lt;pre&gt;&lt;code&gt;
  24. var store = new Ext.data.JsonStore({
  25. // store configs
  26. autoDestroy: true,
  27. url: 'get-images.php',
  28. storeId: 'myStore',
  29. // reader configs
  30. root: 'images',
  31. idProperty: 'name',
  32. fields: ['name', 'url', {name:'size', type: 'float'}, {name:'lastmod', type:'date'}]
  33. });
  34. * &lt;/code&gt;&lt;/pre&gt;&lt;/p&gt;
  35. * &lt;p&gt;This store is configured to consume a returned object of the form:&lt;pre&gt;&lt;code&gt;
  36. {
  37. images: [
  38. {name: 'Image one', url:'/GetImage.php?id=1', size:46.5, lastmod: new Date(2007, 10, 29)},
  39. {name: 'Image Two', url:'/GetImage.php?id=2', size:43.2, lastmod: new Date(2007, 10, 30)}
  40. ]
  41. }
  42. * &lt;/code&gt;&lt;/pre&gt;
  43. * An object literal of this form could also be used as the {@link #data} config option.&lt;/p&gt;
  44. * &lt;p&gt;&lt;b&gt;*Note:&lt;/b&gt; Although not listed here, this class accepts all of the configuration options of
  45. * &lt;b&gt;{@link Ext.data.JsonReader JsonReader}&lt;/b&gt;.&lt;/p&gt;
  46. * @constructor
  47. * @param {Object} config
  48. * @xtype jsonstore
  49. */
  50. Ext.data.JsonStore = Ext.extend(Ext.data.Store, {
  51. <span id='Ext-data-JsonStore-cfg-reader'> /**
  52. </span> * @cfg {Ext.data.DataReader} reader @hide
  53. */
  54. constructor: function(config){
  55. Ext.data.JsonStore.superclass.constructor.call(this, Ext.apply(config, {
  56. reader: new Ext.data.JsonReader(config)
  57. }));
  58. }
  59. });
  60. Ext.reg('jsonstore', Ext.data.JsonStore);</pre>
  61. </body>
  62. </html>