Caplin Trader 5.1.0

Class: module:ct-grid/GridColumn

module:ct-grid/GridColumn(columnModel, properties, filtersopt)

A GridColumn represents a column within the grid, and allows the width of the column, and any sort order or display filters to be accessed and/or modified.

Constructor

new module:ct-grid/GridColumn(columnModel, properties, filtersopt)

Constructs a GridColumn instance — end-users will never need to do this themselves since grids are fully constructed based on their XML definition files by the module:ct-grid/GridComponentFactory class.

Parameters:
Name Type Attributes Default Description
columnModel module:ct-grid/GridColumnModel

The column model that this column is a member of.

properties Map

A map of all the properties extracted from the XML configuration.

Properties
Name Type Attributes Default Description
id string

The column id

displayName string <optional>
properties.id

The column's display name (as presented to the user).

fields string

Comma separated list of fields

width string <optional>
"100"

The column width

filters Array.<module:ct-grid/GridColumnFilter> <optional>
[]

The list of filter instances that will be applied to the column.

Throws:

If the specified width is not a number, or the properties are invalid.

Type
module:ct-core/Error

Members

(static, readonly) SORT_ASC :integer

The constant definition used when invoking module:ct-grid/GridColumn#setSortOrder and requesting an ascending sort.

Type:
  • integer

(static, readonly) SORT_DESC :integer

The constant definition used when invoking module:ct-grid/GridColumn#setSortOrder and requesting a descending sort.

Type:
  • integer

(static, readonly) SORT_NONE :integer

The constant definition used when invoking module:ct-grid/GridColumn#setSortOrder and requesting no sort at all.

Type:
  • integer

Methods

addFilter(filterType, filterValue)

Add a filter to this column that will limit the available rows within the grid.

The available filter types that can be added to this column are LESS_THAN, GREATER_THAN, EXACT_MATCH, PARTIAL_MATCH, WILDCARD, WILDCARD_CASE_SENSITIVE, REGULAR_EXPRESSION and REGULAR_EXPRESSION_CASE_INSENSITIVE.

Parameters:
Name Type Description
filterType integer

The type of filter to apply to this column.

filterValue string

The value that will be used to filter this column with.

See:

clearFilters()

Removes all the filters that this column is currently using to filter values with.

See:

createElementRenderer() → {module:ct-element/Renderer}

Returns:

a new instance of the renderer this column uses to perform cell rendering.

Type
module:ct-element/Renderer

createHeaderElementRenderer(fieldNames) → {module:ct-element/Renderer}

Parameters:
Name Type Description
fieldNames Array.<string>

The field names to pass to the renderer.

Returns:

a new instance of the renderer this column uses to perform header rendering.

Type
module:ct-element/Renderer

getCellRendererType()

Returns the Cell Renderer Type for this column.

Returns:

Object

getClassNames() → {string}

Returns:

the css class names that this column will use to display itself.

Type
string

getColumnIndex() → {integer}

Returns:

the index of the column within the column model, or null if the column is not currently an active column within the model.

Type
integer

getColumnModel() → {module:ct-grid/GridColumnModel}

Returns:

the underlying grid column model that this column is a member of.

Type
module:ct-grid/GridColumnModel

getFieldNames() → {Array.<string>}

Returns:

The list of field names required by this column.

Type
Array.<string>

getFilterExpressions() → {Array.<module:ct-grid/filter/FilterExpression>}

Returns all the filter expressions that this column is currently using to perform row filtering with. These may be more useful than GridColumnFilters because they contain the userInputtedValue.

Returns:

the array of filter expression instances.

Type
Array.<module:ct-grid/filter/FilterExpression>

getFilters() → {Array.<module:ct-grid/GridColumnFilter>}

Returns all the filters that this column is currently using to perform row filtering with.

See:
Returns:

the array of filter instances.

Type
Array.<module:ct-grid/GridColumnFilter>

getFriendlyName() → {string}

Returns:

the friendly name that this column will use to display itself.

Type
string

getHeaderRendererName() → {string}

Returns:

the Header Renderer Name for this column.

Type
string

getHeaderRendererType()

Returns the Header Renderer Type for this column.

Returns:

Object

getIdentityName() → {string}

Returns:

the name that uniquely identifies this column (as defined with the XML configuration for this grid).

Type
string

getPrimaryFieldName() → {string}

Returns:

the name of the primary field being displayed by this column.

Type
string

getPrimaryFieldType() → {string}

Returns:

the type of the primary field being displayed by this column (one of the type constants defined within module:ct-grid/sort/FieldSortRule).

Type
string

getSortOrder() → {integer}

Returns the sort order that is currently set on this column.

Returns:
Type
integer

getSortType() → {string}

Returns:

the name of the sort type, will return the primary field type if a custom sort type was not defined.

Type
string

getValue(fieldName)

Returns the value associated with the supplied field name.

Parameters:
Name Type Description
fieldName string

The field name

getWidth() → {integer}

Returns:

the defined width of the column.

Type
integer

getWidthBeforeLatestColumnWidth() → {integer}

Returns:

If the columns width changes this will return the value before the latest change. If the width hasn't changed then it will return the current width.

Type
integer

isClear() → {boolean}

Determines whether a column is static or not.

Returns:

true if this column value must always be retained when grids are hidden , and false otherwise.

Type
boolean

isFixed() → {boolean}

Determines whether a column is fixed or not.

Returns:

true if this column is fixed in place and false otherwise.

Type
boolean

isMandatory() → {boolean}

Determines whether a column is optional or not.

Returns:

true if this column must always be displayed within a grid, and false otherwise.

Type
boolean

isResizable() → {boolean}

Determines whether a column is resizable or not.

Returns:

true if this column is allowed to be resized, and false otherwise.

Type
boolean

isSortable() → {boolean}

Returns:

the flag indicating whether or not this column can be sorted on (defined within the XML configuration for this grid column).

Type
boolean

setFilters(…filtersopt)

Clears the current filters and adds a new set. Equivalent to clearing and then adding the individual filters except it only results in a single subscription.

Parameters:
Name Type Attributes Description
filters module:ct-grid/GridColumnFilter <optional>
<repeatable>

The list of filter instances that will be applied to the column.

See:

setSortOrder(sortOrder)

Sets the sort order that this column should use for sorting.

Parameters:
Name Type Description
sortOrder integer

The sort order that this column should be sorted by.

This should be module:ct-grid/GridColumn.SORT_NONE for no sorting, module:ct-grid/GridColumn.SORT_ASC to sort this column ascendingly, or module:ct-grid/GridColumn.SORT_DESC to sort this column descendingly.

Throws:
Type
module:ct-core/Error

setValue(fieldName, vFieldValue)

Sets the value of the specified field.

Parameters:
Name Type Description
fieldName string

The field name

vFieldValue Variant

The field value

setWidth(width)

Sets the width of this column.

Parameters:
Name Type Description
width integer

The width to set this column to.

Throws:

if the specified width is not a positive integer.

Type
module:ct-core/Error