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