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