Constructor
new module:caplin/grid/GridView(gridDefinition, gridRowModel, gridColumnModel, gridDecorators)
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. |
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. Usemodule: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. -
canReceive()
-
canReceiveMultipleObjects()
-
canReceiveObjects()
-
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 -
getElementIndicies(element) → {Map}
-
Returns the map containing the row and column indices (
rowIndex
andcolumnIndex
respectively) for the specified cell element. If the specified cell represents a header, only acolumnIndex
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 therowIndex
andcolumnIndex
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. -
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. -
getGridRowSelectionModel() → {module:caplin/grid/GridRowSelectionModel}
-
Returns the row selection model being used with the grid.
Returns:
The row selection model. -
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 -
getHeaderRowElement() → {HTMLElement}
-
Returns the header row.
Returns:
The DOM element the header row is rendered within.- Type
- HTMLElement
-
getLastReceiveFailureMessage()
-
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()
-
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.
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, andfalse
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, andfalse
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()
-
onColumnsAdded()
-
onColumnsRemoved()
-
onFiltersChanged()
-
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 -
onRowContentsChanged()
-
onRowDataUnavailable()
-
onRowStructureChanged()
-
onScroll()
-
- See:
-
- module:caplin/grid/scroll/ScrollPaneListener#onScroll
-
onScrollComplete()
-
- See:
-
- module:caplin/grid/scroll/ScrollPaneListener#onScrollComplete
-
onSizeChanged()
-
onSortColumnChanged()
-
onStartIndexChanged()
-
onWidthChanged()
-
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()
-
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. -
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.