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.

81 lines
2.7 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-StoreMgr'>/**
  19. </span> * @class Ext.StoreMgr
  20. * @extends Ext.util.MixedCollection
  21. * The default global group of stores.
  22. * @singleton
  23. */
  24. Ext.StoreMgr = Ext.apply(new Ext.util.MixedCollection(), {
  25. <span id='Ext-StoreMgr-cfg-listeners'> /**
  26. </span> * @cfg {Object} listeners @hide
  27. */
  28. <span id='Ext-StoreMgr-method-register'> /**
  29. </span> * Registers one or more Stores with the StoreMgr. You do not normally need to register stores
  30. * manually. Any store initialized with a {@link Ext.data.Store#storeId} will be auto-registered.
  31. * @param {Ext.data.Store...} stores Any number of Store instances
  32. */
  33. register : function(){
  34. for(var i = 0, s; (s = arguments[i]); i++){
  35. this.add(s);
  36. }
  37. },
  38. <span id='Ext-StoreMgr-method-unregister'> /**
  39. </span> * Unregisters one or more Stores with the StoreMgr
  40. * @param {String/Object} ids IDs of the Stores, or Store instances
  41. */
  42. unregister : function(){
  43. for(var i = 0, s; (s = arguments[i]); i++){
  44. this.remove(this.lookup(s));
  45. }
  46. },
  47. <span id='Ext-StoreMgr-method-lookup'> /**
  48. </span> * Gets a registered Store by id
  49. * @param {String/Object} id The id of the Store, or a Store instance
  50. * @return {Ext.data.Store}
  51. */
  52. lookup : function(id){
  53. if(Ext.isArray(id)){
  54. var fields = ['field1'], expand = !Ext.isArray(id[0]);
  55. if(!expand){
  56. for(var i = 2, len = id[0].length; i &lt;= len; ++i){
  57. fields.push('field' + i);
  58. }
  59. }
  60. return new Ext.data.ArrayStore({
  61. fields: fields,
  62. data: id,
  63. expandData: expand,
  64. autoDestroy: true,
  65. autoCreated: true
  66. });
  67. }
  68. return Ext.isObject(id) ? (id.events ? id : Ext.create(id, 'store')) : this.get(id);
  69. },
  70. // getKey implementation for MixedCollection
  71. getKey : function(o){
  72. return o.storeId;
  73. }
  74. });</pre>
  75. </body>
  76. </html>