new Column(behavior, columnSchema)
Create a new Column
object.
Parameters:
Name | Type | Attributes | Description |
---|---|---|---|
behavior |
Behavior | ||
columnSchema |
object | ||
columnSchema.index |
number | ||
columnSchema.name |
string | ||
columnSchema.header |
string |
<optional> |
Displayed in column headers. If not defined, name is used. |
columnSchema.calculator |
function |
<optional> |
Define to make a computed column. |
columnSchema.type |
string |
<optional> |
For possible data model use. (Not used in core.) Positive values of Negative values of |
- Mixes In:
- cellProperties.columnMixin
- columnProperties.mixin
- See:
-
module:Cell
is mixed into Column.prototype.
Members
calculator :string
Get or set the computed column's calculator function.
Setting the value here updates the calculator in both:
- the
calculator
array in the underlying data source; and - the filter.
The results of the new calculations will appear in the column cells on the next repaint.
Type:
- string
header :string
Get or set the text of the column's header.
The header is the label at the top of the column.
Setting the header updates both:
- the
schema
(aka, header) array in the underlying data source; and - the filter.
Type:
- string
type :string
Get or set the type of the column's header.
Setting the type updates the filter which typically uses this information for proper collation.
Type:
- string
Methods
addCellProperties(rowIndex, properties) → {object}
Parameters:
Name | Type | Description |
---|---|---|
rowIndex |
number | Data row coordinate. |
properties |
object | undefined | Hash of cell properties. If |
Returns:
Cell's own properties object, which will be created by this call if it did not already exist.
- Type
- object
addProperties(properties, settingStateopt)
Copy a properties collection to this column's properties object.
When a value is undefined
or null
, the property is deleted except when a setter or non-configurable in which case it's set to undefined
.
Parameters:
Name | Type | Attributes | Description |
---|---|---|---|
properties |
object | undefined | Properties to copy to column's properties object. If |
|
settingState |
boolean |
<optional> |
Clear column's properties object before copying properties. |
createColumnProperties() → {object}
This:
- {Column}
Returns:
- Type
- object
getCellEditorAt(cellEvent) → {undefined|CellEditor}
Get a new cell editor.
The cell editor to use must be registered with the key in the cell's editor
property.
The cell's format
property is mixed into the provided cellEvent for possible overriding by developer's override of DataModel.prototype.getCellEditorAt
before being used by CellEditor
to parse and format the cell value.
Parameters:
Name | Type | Description |
---|---|---|
cellEvent |
CellEvent |
Returns:
Falsy value means either no declared cell editor or instantiation aborted by falsy return from fireRequestCellEdit
.
- Type
- undefined | CellEditor
getCellOwnProperties(rowIndex) → {null|object}
Get the cell's own properties object.
Due to memory constraints, we don't create a cell options properties object for every cell.
If the cell has its own properties object, it:
- was created by a previous call to
setCellProperties
orsetCellProperty
- has the column properties object as its prototype
- is returned
If the cell does not have its own properties object, this method returns null
.
Call this method only when you need to know if the the cell has its own properties object; otherwise call getCellProperties
.
Parameters:
Name | Type | Description |
---|---|---|
rowIndex |
number | Data row coordinate. |
Returns:
The "own" properties of the cell at x,y in the grid. If the cell does not own a properties object, returns undefined
.
- Type
- null | object
getCellProperties(rowIndex) → {object}
Get the properties object for cell.
This is the cell's own properties object if found; else the column object.
If you are seeking a single specific property, consider calling Column#getCellProperty
instead (which calls this method).
Parameters:
Name | Type | Description |
---|---|---|
rowIndex |
number | Data row coordinate. |
Returns:
The properties of the cell at x,y in the grid.
- Type
- object
getCellProperty(rowIndex, key) → {object}
Return a specific cell property.
If there is no cell properties object, defers to column properties object.
Parameters:
Name | Type | Description |
---|---|---|
rowIndex |
number | Data row coordinate. |
key |
string |
Returns:
The specified property for the cell at x,y in the grid.
- Type
- object
setBackgroundColor(color)
This method is provided because some grid renderer optimizations require that the grid renderer be informed when column colors change. Due to performance concerns, they cannot take the time to figure it out for themselves. Along the same lines, making the property a getter/setter (in columnProperties.js), though doable, might present performance concerns as this property is possibly the most accessed of all column properties.
Parameters:
Name | Type | Description |
---|---|---|
color |
setCellProperties(rowIndex, properties) → {*}
Parameters:
Name | Type | Description |
---|---|---|
rowIndex |
number | Data row coordinate. |
properties |
object | undefined | Hash of cell properties. If |
Returns:
New cell properties object, based on column properties object, with properties
copied to it.
- Type
- *
setCellProperty(rowIndex, key, value) → {object}
Parameters:
Name | Type | Description |
---|---|---|
rowIndex |
number | Data row coordinate. |
key |
string | |
value |
Returns:
- Type
- object
setProperties(properties, preserveopt)
Parameters:
Name | Type | Attributes | Default | Description |
---|---|---|---|---|
properties |
object | |||
preserve |
boolean |
<optional> |
false |