Caplin Trader 4.8.0

Class: module:caplin/grid/GridView

module:caplin/grid/GridView

The class within the caplin.grid package that is responsible for displaying the rows specified within the provided module:caplin/grid/GridRowModel, and the columns specified within the provided module:caplin/grid/GridColumnModel. Additionally, GridView implements the module:caplin/component/Component interface so that it can be rendered within a web-based windowing framework (e.g. webcentric), and communicates with any specified module:caplin/grid/decorator/GridDecorator instances — these allow the grid functionality to be augmented in a modular way.

The GridView class is not designed to be constructed directly by user's of the CaplinTrader APIs. Instead, grid assemblies are defined using XML, and are constructed on demand using module:caplin/grid/GridComponentFactory.

Constructor

new module:caplin/grid/GridView(gridDefinition, gridRowModel, gridColumnModel, gridDecorators)

Constructs a new GridView with the specified arguments.

This constructor should not be called directly, but instead module:caplin/grid/GridComponentFactory should be used for the construction of all grid assemblies.

Parameters:
Name Type Description
gridDefinition module:caplin/grid/GridDefinition | GridDefinition The compiled XML definition of this grid.
gridRowModel module:caplin/grid/GridRowModel | GridRowModel The row model to be displayed by this grid.
gridColumnModel module:caplin/grid/GridColumnModel | GridColumnModel The column model to be displayed by this grid.
gridDecorators Array.<module:caplin/grid/decorator/GridDecorator> The GridDecorator instances to be applied to this grid.
Implements:

Methods

addColumnHeaderRendererListener(listener)

Adds an module:caplin/element/RendererEventListener listener to the grid view. Any events raised on any of the renderers on the GridView will raise an event. Use module:caplin/grid/GridView#removeColumnHeaderRendererListener to remove a listener.
Parameters:
Name Type Description
listener module:caplin/element/RendererEventListener The listener to listen to for renderer events.

addGridViewListener(gridViewListener)

Adds a listener to the grid view, to be communicated of all grid level events.
Parameters:
Name Type Description
gridViewListener module:caplin/grid/GridViewListener The grid view listener to add.

addRendererEventListener(rendererEventListener)

Adds a RendererEventListener to listen to any of the events that occur on renderers in the GridView.
Parameters:
Name Type Description
rendererEventListener module:caplin/element/RendererEventListener the listener to add.
See:

canReceive()

See:

canReceiveMultipleObjects()

See:

canReceiveObjects()

See:

getCellElement(rowIndex, columnIndex) → {HTMLElement}

Returns the cell for the specified row and column.
Parameters:
Name Type Description
rowIndex integer The row index of the cell
columnIndex integer The column index of the cell
Returns:
The DOM element the cell is being rendered within.
Type
HTMLElement

getCellRenderer(rowIndex, columnIndex) → {module:caplin/element/Renderer}

Returns the cell renderer responsible for rendering the given row and column indices.
Parameters:
Name Type Description
rowIndex integer The index of the row for which the cell renderer will be returned.
columnIndex integer The index of the column for which the cell renderer will be returned.
Returns:
the cell renderer responsible for rendering the given row and column indices
Type
module:caplin/element/Renderer

getElementIndicies(element) → {Map}

Returns the map containing the row and column indices (rowIndex and columnIndex respectively) for the specified cell element. If the specified cell represents a header, only a columnIndex will be returned within the map.
Parameters:
Name Type Description
element HTMLElement The cell element for which the indices are required.
Returns:
A map containing the rowIndex and columnIndex for the given element.
Type
Map

getGridColumnModel() → {module:caplin/grid/GridColumnModel}

Returns the underlying column model being used with the grid.
Returns:
The column model.
Type
module:caplin/grid/GridColumnModel

getGridDecorators() → {Array}

Returns the decorators held by this Grid View
Returns:
The decorators held by this Grid View
Type
Array

getGridDefinition() → {module:caplin/grid/GridDefinition|GridDefinition}

Returns the compiled XML definition of this grid.
Returns:
the compiled XML definition of the grid.
Type
module:caplin/grid/GridDefinition | GridDefinition

getGridRowModel() → {module:caplin/grid/GridRowModel}

Returns the underlying row model being used with the grid.
Returns:
The row model.
Type
module:caplin/grid/GridRowModel

getGridRowSelectionModel() → {module:caplin/grid/GridRowSelectionModel}

Returns the row selection model being used with the grid.
Returns:
The row selection model.
Type
module:caplin/grid/GridRowSelectionModel

getHeaderCellElement(columnIndex) → {HTMLElement}

Returns the header cell for the specified column.
Parameters:
Name Type Description
columnIndex integer The column index of the cell
Returns:
The DOM element the given header cell is rendered within.
Type
HTMLElement

getHeaderRenderer(columnIndex) → {module:caplin/element/Renderer}

Returns the header renderer responsible for rendering the given column index.
Parameters:
Name Type Description
columnIndex integer The index of the column for which the header renderer will be returned.
Returns:
the header renderer responsible for rendering the given column index
Type
module:caplin/element/Renderer

getHeaderRowElement() → {HTMLElement}

Returns the header row.
Returns:
The DOM element the header row is rendered within.
Type
HTMLElement

getLastReceiveFailureMessage()

See:

getNumberOfDisplayedRows() → {integer}

Returns the number of rendered rows visible in the grid at the present point in time.
Returns:
The number of currently displayed rows.
Type
integer

getNumberOfDisplayedRows() → {integer}

Returns the number of rendered rows visible in the grid at the present point in time.
Returns:
The number of currently displayed rows.
Type
integer

getRendererTypes() → {Array}

Returns an array containing all Renderer Types for every column.
Returns:
all renderer tpyes for every column
Type
Array

getRendererTypesIndexedByColumnName() → {Map}

Returns a map containing all Renderer Types for every column, indexed by column friendly name.
Returns:
all of the renderer types for every column.
Type
Map

getRowContainerElement() → {HTMLElement}

Returns the grid row container element.
Returns:
The DOM element the rows are being rendered within.
Type
HTMLElement

getRowElement(rowIndex) → {HTMLElement}

Returns the row element with the specified row index.
Parameters:
Name Type Description
rowIndex integer The row index
Returns:
The DOM element the given row is rendered within.
Type
HTMLElement

getStartIndex() → {integer}

Returns the index representing the first row in the grid.
Returns:
the index representing the first row in the grid.
Type
integer

getSuccessMessage()

See:

getTotalRowCount() → {integer}

Returns the total number of rows in the dataset.
Returns:
The total number of rows.
Type
integer

getUniqueComponentId() → {string}

Gets a guaranteed ID for this component instance.
Implements:
Returns:
A unique ID
Type
string

getVisibleRowCount() → {integer}

Returns the number of visible, populated rows in the grid.
Returns:
The number of visible rows.
Type
integer

isColumnInView(columnIndex) → {boolean}

Determines whether the specified column is in view.
Parameters:
Name Type Description
columnIndex integer The column index corresponding to the column
Returns:
true if the column is in view, and false otherwise.
Type
boolean

isRowInView(rowIndex) → {boolean}

Determines whether the specified row is in view.
Parameters:
Name Type Description
rowIndex integer The row index corresponding to the row
Returns:
true if the row is in view, and false otherwise.
Type
boolean

isScrolling() → {boolean}

Test if the grid is currently being scrolled.
Returns:
true if the grid is currently being scrolled.
Type
boolean

isSortable()

The grid is sortable, unless it is empty.

markAsDirty()

Calling this method will inform webcentric that the user's layout has changed. The layout will be marked using a *, informing the user that they must save their sheet to save any changes that have been made.

onAllDataReceived()

Implements:
See:

onColumnsAdded()

Implements:
See:

onColumnsRemoved()

Implements:
See:

onFiltersChanged()

Implements:
See:

onRendererEvent(renderer, rendererEvent, options)

The callback function to receive Renderer events.
Parameters:
Name Type Description
renderer module:caplin/element/Renderer The renderer raising the event.
rendererEvent Map The renderer event
options Map The event parameters
Implements:
See:

onRowContentsChanged()

Implements:
See:

onRowDataUnavailable()

Implements:
See:

onRowStructureChanged()

Implements:
See:

onScroll()

See:
  • module:caplin/grid/scroll/ScrollPaneListener#onScroll

onScrollComplete()

See:
  • module:caplin/grid/scroll/ScrollPaneListener#onScrollComplete

onSizeChanged()

Implements:
See:

onSortColumnChanged()

Implements:
See:

onStartIndexChanged()

Implements:
See:

onWidthChanged()

Implements:
See:

recalculateHeights()

Inform the grid that the styling applied to the grids has dynamically changed, affecting the current column header and/or rows heights.

Some uses of the grid may involve changing the display mode at runtime, so that the column headers or the rows themselves have a different height in these different modes. Although a display mode switch may be affected by the developer by setting a class name on the root grid element, and having different CSS rules for each mode, the grid must also be informed about this so that it's rendering logic can continue to work.

receiveObjects()

See:

removeColumnHeaderRendererListener(listener)

Removes a listener previously been added via {#addColumnHeaderRendererListener}.
Parameters:
Name Type Description
listener module:caplin/element/RendererEventListener The listener to remove.

removeGridViewListener(gridViewListener)

Removes a previously registered grid view listener.
Parameters:
Name Type Description
gridViewListener module:caplin/grid/GridViewListener The grid view listener to remove.

removeRendererEventListener(rendererEventListener)

Removes a RendererEventListener that was added with #addRendererEventListener
Parameters:
Name Type Description
rendererEventListener module:caplin/element/RendererEventListener the listener to remove.
See:

setStartIndex(startIndex)

Set the first row being displayed within the grid.
Parameters:
Name Type Description
startIndex integer The row that will be displayed at the top of the grid.