Upgrade to ExtJS 4.0.2 - Released 06/09/2011
[extjs.git] / src / grid / property / Property.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  * @class Ext.grid.property.Property
17  * A specific {@link Ext.data.Model} type that represents a name/value pair and is made to work with the
18  * {@link Ext.grid.property.Grid}.  Typically, Properties do not need to be created directly as they can be
19  * created implicitly by simply using the appropriate data configs either via the {@link Ext.grid.property.Grid#source}
20  * config property or by calling {@link Ext.grid.property.Grid#setSource}.  However, if the need arises, these records
21  * can also be created explicitly as shown below.  Example usage:
22  * <pre><code>
23 var rec = new Ext.grid.property.Property({
24     name: 'birthday',
25     value: Ext.Date.parse('17/06/1962', 'd/m/Y')
26 });
27 // Add record to an already populated grid
28 grid.store.addSorted(rec);
29 </code></pre>
30  * @constructor
31  * @param {Object} config A data object in the format:<pre><code>
32 {
33     name: [name],
34     value: [value]
35 }</code></pre>
36  * The specified value's type
37  * will be read automatically by the grid to determine the type of editor to use when displaying it.
38  */
39 Ext.define('Ext.grid.property.Property', {
40     extend: 'Ext.data.Model',
41
42     alternateClassName: 'Ext.PropGridProperty',
43
44     fields: [{
45         name: 'name',
46         type: 'string'
47     }, {
48         name: 'value'
49     }],
50     idProperty: 'name'
51 });