Upgrade to ExtJS 4.0.7 - Released 10/19/2011
[extjs.git] / src / data / DirectStore.js
1 /*
2
3 This file is part of Ext JS 4
4
5 Copyright (c) 2011 Sencha Inc
6
7 Contact:  http://www.sencha.com/contact
8
9 GNU General Public License Usage
10 This file may be used under the terms of the GNU General Public License version 3.0 as published by the Free Software Foundation and appearing in the file LICENSE included in the packaging of this file.  Please review the following information to ensure the GNU General Public License version 3.0 requirements will be met: http://www.gnu.org/copyleft/gpl.html.
11
12 If you are unsure which license is appropriate for your use, please contact the sales department at http://www.sencha.com/contact.
13
14 */
15 /**
16  * Small helper class to create an {@link Ext.data.Store} configured with an {@link Ext.data.proxy.Direct}
17  * and {@link Ext.data.reader.Json} to make interacting with an {@link Ext.direct.Manager} server-side
18  * {@link Ext.direct.Provider Provider} easier. To create a different proxy/reader combination create a basic
19  * {@link Ext.data.Store} configured as needed.
20  *
21  * **Note:** Although they are not listed, this class inherits all of the config options of:
22  *
23  * - **{@link Ext.data.Store Store}**
24  *
25  * - **{@link Ext.data.reader.Json JsonReader}**
26  *
27  *   - **{@link Ext.data.reader.Json#root root}**
28  *   - **{@link Ext.data.reader.Json#idProperty idProperty}**
29  *   - **{@link Ext.data.reader.Json#totalProperty totalProperty}**
30  *
31  * - **{@link Ext.data.proxy.Direct DirectProxy}**
32  *
33  *   - **{@link Ext.data.proxy.Direct#directFn directFn}**
34  *   - **{@link Ext.data.proxy.Direct#paramOrder paramOrder}**
35  *   - **{@link Ext.data.proxy.Direct#paramsAsHash paramsAsHash}**
36  *
37  */
38 Ext.define('Ext.data.DirectStore', {
39     /* Begin Definitions */
40     
41     extend: 'Ext.data.Store',
42     
43     alias: 'store.direct',
44     
45     requires: ['Ext.data.proxy.Direct'],
46    
47     /* End Definitions */
48
49     constructor : function(config){
50         config = Ext.apply({}, config);
51         if (!config.proxy) {
52             var proxy = {
53                 type: 'direct',
54                 reader: {
55                     type: 'json'
56                 }
57             };
58             Ext.copyTo(proxy, config, 'paramOrder,paramsAsHash,directFn,api,simpleSortMode');
59             Ext.copyTo(proxy.reader, config, 'totalProperty,root,idProperty');
60             config.proxy = proxy;
61         }
62         this.callParent([config]);
63     }    
64 });
65