Caplin Trader 4.0.3

Class: module:caplin/grid/GridColumn

module:caplin/grid/GridColumn

Summary

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(oColumnModel, mProperties, pFiltersopt)

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
oColumnModel module:caplin/grid/GridColumnModel The column model that this column is a member of.
mProperties Map A map of all the properties extracted from the XML configuration.
pFilters Array <optional>
[] The list of module:caplin/grid/GridColumnFilter 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 :int

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

(static, readonly) SORT_DESC :int

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

(static, readonly) SORT_NONE :int

The constant definition used when invoking module:caplin/grid/GridColumn#setSortOrder and requesting no sort at all.
Type:
  • int

Methods

addFilter(nFilterType, sFilterValue)

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
nFilterType int The type of filter to apply to this column.
sFilterValue 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()

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

createHeaderElementRenderer(pFieldNames)

Returns a new instance of the module:caplin/element/Renderer this column uses to perform header rendering.
Parameters:
Name Type Description
pFieldNames Array The field names to pass to the renderer.

getCellRendererType()

Returns the Cell Renderer Type for this column.
Returns:
Object

getClassNames()

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

getColumnIndex()

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

getColumnModel()

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

getFieldNames() → {Array}

Returns the field names that are required by this column.
Returns:
An array of field names as strings.
Type
Array

getFilters() → {Array}

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

getFriendlyName()

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

getIdentityName()

Return the name that uniquely identifies this column, as defined with the XML configuration for this grid.

getPrimaryFieldName()

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

getPrimaryFieldType() → {String}

Returns the type of the primary field being displayed by this column.
Returns:
One of the type constants defined within module:caplin/grid/sort/FieldSortRule.
Type
String

getSortOrder() → {int}

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

getValue(sFieldName)

Returns the value associated with the supplied field name.
Parameters:
Name Type Description
sFieldName String The field name

getWidth()

Returns the width that this column has been set to.

getWidthBeforeLatestColumnWidth()

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.

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()

Return the boolean flag indicating whether or not this column can be sorted on as defined within the XML configuration for this grid column.

setSortOrder(nSortOrder)

Sets the sort order that this column should use for sorting.
Parameters:
Name Type Description
nSortOrder int 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(sFieldName, vFieldValue)

Sets the value of the specified field.
Parameters:
Name Type Description
sFieldName String The field name
vFieldValue Variant The field value

setWidth(nWidth)

Sets the width of this column.
Parameters:
Name Type Description
nWidth int The width to set this column to.
Throws:
if the specified width is not a positive integer.
Type
module:caplin/core/Error