Upgrade to ExtJS 4.0.2 - Released 06/09/2011
[extjs.git] / src / data / ResultSet.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  * @author Ed Spencer
17  * @class Ext.data.ResultSet
18  * @extends Object
19  * 
20  * <p>Simple wrapper class that represents a set of records returned by a Proxy.</p>
21  */
22 Ext.define('Ext.data.ResultSet', {
23     /**
24      * @cfg {Boolean} loaded
25      * True if the records have already been loaded. This is only meaningful when dealing with
26      * SQL-backed proxies
27      */
28     loaded: true,
29     
30     /**
31      * @cfg {Number} count
32      * The number of records in this ResultSet. Note that total may differ from this number
33      */
34     count: 0,
35     
36     /**
37      * @cfg {Number} total
38      * The total number of records reported by the data source. This ResultSet may form a subset of
39      * those records (see count)
40      */
41     total: 0,
42     
43     /**
44      * @cfg {Boolean} success
45      * True if the ResultSet loaded successfully, false if any errors were encountered
46      */
47     success: false,
48     
49     /**
50      * @cfg {Array} records The array of record instances. Required
51      */
52
53     /**
54      * Creates the resultSet
55      * @param {Object} config (optional) Config object.
56      */
57     constructor: function(config) {
58         Ext.apply(this, config);
59         
60         /**
61          * DEPRECATED - will be removed in Ext JS 5.0. This is just a copy of this.total - use that instead
62          * @property totalRecords
63          * @type Mixed
64          */
65         this.totalRecords = this.total;
66         
67         if (config.count === undefined) {
68             this.count = this.records.length;
69         }
70     }
71 });