Caplin Trader 4.8.0

Class: module:caplin/grid/GridColumn

module:caplin/grid/GridColumn

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:caplin/grid/GridColumn(columnModel, properties, filtersopt)

Constructs a caplin.grid.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:caplin/grid/GridComponentFactory class.
Parameters:
Name Type Attributes Default Description
columnModel module:caplin/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:caplin/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:caplin/core/Error

Members

(static, readonly) SORT_ASC :integer

The constant definition used when invoking module:caplin/grid/GridColumn#setSortOrder and requesting an ascending sort.
Type:
  • integer

(static, readonly) SORT_DESC :integer

The constant definition used when invoking module:caplin/grid/GridColumn#setSortOrder and requesting a descending sort.
Type:
  • integer

(static, readonly) SORT_NONE :integer

The constant definition used when invoking module:caplin/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:caplin/element/Renderer}

Returns:
a new instance of the renderer this column uses to perform cell rendering.
Type
module:caplin/element/Renderer

createHeaderElementRenderer(fieldNames) → {module:caplin/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:caplin/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:caplin/grid/GridColumnModel}

Returns:
the underlying grid column model that this column is a member of.
Type
module:caplin/grid/GridColumnModel

getFieldNames() → {Array.<string>}

Returns:
The list of field names required by this column.
Type
Array.<string>

getFilterExpressions() → {Array.<module:caplin/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:caplin/grid/filter/FilterExpression>

getFilters() → {Array.<module:caplin/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:caplin/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:caplin/grid/sort/FieldSortRule).
Type
string

getSortOrder() → {integer}

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

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

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:caplin/grid/GridColumn.SORT_NONE for no sorting, module:caplin/grid/GridColumn.SORT_ASC to sort this column ascendingly, or module:caplin/grid/GridColumn.SORT_DESC to sort this column descendingly.

Throws:
Type
module:caplin/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:caplin/core/Error