Upgrade to ExtJS 4.0.0 - Released 04/26/2011
[extjs.git] / src / data / ResultSet.js
1 /**
2  * @author Ed Spencer
3  * @class Ext.data.ResultSet
4  * @extends Object
5  * 
6  * <p>Simple wrapper class that represents a set of records returned by a Proxy.</p>
7  * 
8  * @constructor
9  * Creates the new ResultSet
10  */
11 Ext.define('Ext.data.ResultSet', {
12     /**
13      * @cfg {Boolean} loaded
14      * True if the records have already been loaded. This is only meaningful when dealing with
15      * SQL-backed proxies
16      */
17     loaded: true,
18     
19     /**
20      * @cfg {Number} count
21      * The number of records in this ResultSet. Note that total may differ from this number
22      */
23     count: 0,
24     
25     /**
26      * @cfg {Number} total
27      * The total number of records reported by the data source. This ResultSet may form a subset of
28      * those records (see count)
29      */
30     total: 0,
31     
32     /**
33      * @cfg {Boolean} success
34      * True if the ResultSet loaded successfully, false if any errors were encountered
35      */
36     success: false,
37     
38     /**
39      * @cfg {Array} records The array of record instances. Required
40      */
41
42     constructor: function(config) {
43         Ext.apply(this, config);
44         
45         /**
46          * DEPRECATED - will be removed in Ext JS 5.0. This is just a copy of this.total - use that instead
47          * @property totalRecords
48          * @type Mixed
49          */
50         this.totalRecords = this.total;
51         
52         if (config.count === undefined) {
53             this.count = this.records.length;
54         }
55     }
56 });