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