1 | /*! |
---|
2 | * Ext JS Library 3.4.0 |
---|
3 | * Copyright(c) 2006-2011 Sencha Inc. |
---|
4 | * licensing@sencha.com |
---|
5 | * http://www.sencha.com/license |
---|
6 | */ |
---|
7 | /** |
---|
8 | * @class Ext.data.DirectStore |
---|
9 | * @extends Ext.data.Store |
---|
10 | * <p>Small helper class to create an {@link Ext.data.Store} configured with an |
---|
11 | * {@link Ext.data.DirectProxy} and {@link Ext.data.JsonReader} to make interacting |
---|
12 | * with an {@link Ext.Direct} Server-side {@link Ext.direct.Provider Provider} easier. |
---|
13 | * To create a different proxy/reader combination create a basic {@link Ext.data.Store} |
---|
14 | * configured as needed.</p> |
---|
15 | * |
---|
16 | * <p><b>*Note:</b> Although they are not listed, this class inherits all of the config options of:</p> |
---|
17 | * <div><ul class="mdetail-params"> |
---|
18 | * <li><b>{@link Ext.data.Store Store}</b></li> |
---|
19 | * <div class="sub-desc"><ul class="mdetail-params"> |
---|
20 | * |
---|
21 | * </ul></div> |
---|
22 | * <li><b>{@link Ext.data.JsonReader JsonReader}</b></li> |
---|
23 | * <div class="sub-desc"><ul class="mdetail-params"> |
---|
24 | * <li><tt><b>{@link Ext.data.JsonReader#root root}</b></tt></li> |
---|
25 | * <li><tt><b>{@link Ext.data.JsonReader#idProperty idProperty}</b></tt></li> |
---|
26 | * <li><tt><b>{@link Ext.data.JsonReader#totalProperty totalProperty}</b></tt></li> |
---|
27 | * </ul></div> |
---|
28 | * |
---|
29 | * <li><b>{@link Ext.data.DirectProxy DirectProxy}</b></li> |
---|
30 | * <div class="sub-desc"><ul class="mdetail-params"> |
---|
31 | * <li><tt><b>{@link Ext.data.DirectProxy#directFn directFn}</b></tt></li> |
---|
32 | * <li><tt><b>{@link Ext.data.DirectProxy#paramOrder paramOrder}</b></tt></li> |
---|
33 | * <li><tt><b>{@link Ext.data.DirectProxy#paramsAsHash paramsAsHash}</b></tt></li> |
---|
34 | * </ul></div> |
---|
35 | * </ul></div> |
---|
36 | * |
---|
37 | * @xtype directstore |
---|
38 | * |
---|
39 | * @constructor |
---|
40 | * @param {Object} config |
---|
41 | */ |
---|
42 | Ext.data.DirectStore = Ext.extend(Ext.data.Store, { |
---|
43 | constructor : function(config){ |
---|
44 | // each transaction upon a singe record will generate a distinct Direct transaction since Direct queues them into one Ajax request. |
---|
45 | var c = Ext.apply({}, { |
---|
46 | batchTransactions: false |
---|
47 | }, config); |
---|
48 | Ext.data.DirectStore.superclass.constructor.call(this, Ext.apply(c, { |
---|
49 | proxy: Ext.isDefined(c.proxy) ? c.proxy : new Ext.data.DirectProxy(Ext.copyTo({}, c, 'paramOrder,paramsAsHash,directFn,api')), |
---|
50 | reader: (!Ext.isDefined(c.reader) && c.fields) ? new Ext.data.JsonReader(Ext.copyTo({}, c, 'totalProperty,root,idProperty'), c.fields) : c.reader |
---|
51 | })); |
---|
52 | } |
---|
53 | }); |
---|
54 | Ext.reg('directstore', Ext.data.DirectStore); |
---|