Class: Column

Column

new Column(behavior, indexOrOptions)

Create a new Column object.

Parameters:
Name Type Description
behavior
indexOrOptions number | string | object

One of:

  • If a positive number, valid index into fields array.
  • If a string, a name in the fields array.
  • If an object, must contain either an index or a name property.

Positive values of index are "real" fields; see also setProperties which is called to set the remaining properties specified in options.

Negative values of index are special cases: index | Meaning :-----: | -------- -1 | Row header column -2 | Tree (drill-down) column

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

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 fields (aka, header) array in the underlying data source; and
  • the filter.
Type:
  • string

index

Index of this column in the fields array.

name

Name of this column from the fields array.

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, preserveopt) → {*}

Parameters:
Name Type Attributes Default Description
rowIndex number

Data row coordinate.

properties Object

Hash of cell properties.

preserve boolean <optional>
false

Falsy creates new object; truthy copies properties members into existing object.

Returns:
Type
*

createColumnProperties() → {object}

This:
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 or setCellProperty
  • 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

Hash of cell properties.

Returns:
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