Upgrade to ExtJS 3.2.2 - Released 06/02/2010
[extjs.git] / docs / source / StoreMgr.html
1 <html>
2 <head>
3   <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />    
4   <title>The source code</title>
5     <link href="../resources/prettify/prettify.css" type="text/css" rel="stylesheet" />
6     <script type="text/javascript" src="../resources/prettify/prettify.js"></script>
7 </head>
8 <body  onload="prettyPrint();">
9     <pre class="prettyprint lang-js">/*!
10  * Ext JS Library 3.2.2
11  * Copyright(c) 2006-2010 Ext JS, Inc.
12  * licensing@extjs.com
13  * http://www.extjs.com/license
14  */
15 <div id="cls-Ext.StoreMgr"></div>/**
16  * @class Ext.StoreMgr
17  * @extends Ext.util.MixedCollection
18  * The default global group of stores.
19  * @singleton
20  */
21 Ext.StoreMgr = Ext.apply(new Ext.util.MixedCollection(), {
22     <div id="cfg-Ext.StoreMgr-listeners"></div>/**
23      * @cfg {Object} listeners @hide
24      */
25
26     <div id="method-Ext.StoreMgr-register"></div>/**
27      * Registers one or more Stores with the StoreMgr. You do not normally need to register stores
28      * manually.  Any store initialized with a {@link Ext.data.Store#storeId} will be auto-registered. 
29      * @param {Ext.data.Store} store1 A Store instance
30      * @param {Ext.data.Store} store2 (optional)
31      * @param {Ext.data.Store} etc... (optional)
32      */
33     register : function(){
34         for(var i = 0, s; (s = arguments[i]); i++){
35             this.add(s);
36         }
37     },
38
39     <div id="method-Ext.StoreMgr-unregister"></div>/**
40      * Unregisters one or more Stores with the StoreMgr
41      * @param {String/Object} id1 The id of the Store, or a Store instance
42      * @param {String/Object} id2 (optional)
43      * @param {String/Object} etc... (optional)
44      */
45     unregister : function(){
46         for(var i = 0, s; (s = arguments[i]); i++){
47             this.remove(this.lookup(s));
48         }
49     },
50
51     <div id="method-Ext.StoreMgr-lookup"></div>/**
52      * Gets a registered Store by id
53      * @param {String/Object} id The id of the Store, or a Store instance
54      * @return {Ext.data.Store}
55      */
56     lookup : function(id){
57         if(Ext.isArray(id)){
58             var fields = ['field1'], expand = !Ext.isArray(id[0]);
59             if(!expand){
60                 for(var i = 2, len = id[0].length; i <= len; ++i){
61                     fields.push('field' + i);
62                 }
63             }
64             return new Ext.data.ArrayStore({
65                 fields: fields,
66                 data: id,
67                 expandData: expand,
68                 autoDestroy: true,
69                 autoCreated: true
70
71             });
72         }
73         return Ext.isObject(id) ? (id.events ? id : Ext.create(id, 'store')) : this.get(id);
74     },
75
76     // getKey implementation for MixedCollection
77     getKey : function(o){
78          return o.storeId;
79     }
80 });</pre>    
81 </body>
82 </html>