Options
All
  • Public
  • Public/Protected
  • All
Menu

Class DataGrid

A widget which implements a high-performance tabular data grid. The namespace for the DataGrid class statics.

Notes

A data grid is implemented as a composition of child widgets. These child widgets are considered an implementation detail. Manipulating the child widgets of a data grid directly is undefined behavior.

This class is not designed to be subclassed.

Hierarchy

  • Widget
    • DataGrid

Implements

  • IMessageHandler
  • IObservableDisposable

Index

Modules

Enumerations

Classes

Interfaces

Type aliases

Constructors

Properties

Accessors

Methods

Object literals

Type aliases

Static ColumnFitType

ColumnFitType: "all" | "row-header" | "body"

A type alias for the supported column auto resize modes.

Static CopyConfig

CopyConfig: object

A type alias for the data grid copy config.

Type declaration

Static CopyFormatArgs

CopyFormatArgs: object

A type alias for the arguments to a copy format function.

Type declaration

Static CopyFormatFunc

CopyFormatFunc: function

A type alias for a copy format function.

Type declaration

Static DefaultSizes

DefaultSizes: object

An object which defines the default sizes for a data grid.

Type declaration

Static HeaderVisibility

HeaderVisibility: "all" | "row" | "column" | "none"

A type alias for the supported header visibility modes.

Static HitTestResult

HitTestResult: object

An object which holds the result of a grid hit test.

Type declaration

Static MinimumSizes

MinimumSizes: object

An object which defines the minimum sizes for a data grid.

Type declaration

Static Style

Style: object

An object which defines the style for a data grid.

Notes

All style colors support the full CSS color syntax.

Type declaration

Constructors

constructor

  • new DataGrid(options?: IOptions): DataGrid
  • Construct a new data grid.

    Parameters

    • Default value options: IOptions = {}

      The options for initializing the data grid.

    Returns DataGrid

Properties

Private _buffer

_buffer: HTMLCanvasElement

Private _bufferGC

_bufferGC: CanvasRenderingContext2D

Private _canvas

_canvas: HTMLCanvasElement

Private _canvasGC

_canvasGC: CanvasRenderingContext2D

Private _cellRenderers

_cellRenderers: RendererMap

Private _columnHeaderSections

_columnHeaderSections: SectionList

Private _columnSections

_columnSections: SectionList

Private _copyConfig

_copyConfig: CopyConfig

Private _dataModel

_dataModel: DataModel | null = null

Private _dpiRatio

_dpiRatio: number = Math.ceil(window.devicePixelRatio)

Private _editingEnabled

_editingEnabled: boolean = false

Private _editorController

_editorController: ICellEditorController | null

Private _hScrollBar

_hScrollBar: ScrollBar

Private _hScrollBarMinHeight

_hScrollBarMinHeight: number = 0

Private _headerVisibility

_headerVisibility: HeaderVisibility

Private _keyHandler

_keyHandler: IKeyHandler | null = null

Private _mouseHandler

_mouseHandler: IMouseHandler | null = null

Private _mousedown

_mousedown: boolean = false

Private _overlay

_overlay: HTMLCanvasElement

Private _overlayGC

_overlayGC: CanvasRenderingContext2D

Private _rowHeaderSections

_rowHeaderSections: SectionList

Private _rowSections

_rowSections: SectionList

Private _scrollCorner

_scrollCorner: Widget

Private _scrollX

_scrollX: number = 0

Private _scrollY

_scrollY: number = 0

Private _selectionModel

_selectionModel: SelectionModel | null = null

Private _stretchLastColumn

_stretchLastColumn: boolean

Private _stretchLastRow

_stretchLastRow: boolean

Private _style

_style: Style

Private _vScrollBar

_vScrollBar: ScrollBar

Private _vScrollBarMinWidth

_vScrollBarMinWidth: number = 0

Private _viewport

_viewport: Widget

Private _viewportHeight

_viewportHeight: number = 0

Private _viewportWidth

_viewportWidth: number = 0

dataset

dataset: DOMStringMap

The dataset for the widget's DOM node.

disposed

disposed: ISignal<this, void>

A signal emitted when the widget is disposed.

hiddenMode

hiddenMode: HiddenMode

Set the method for hiding the widget.

id

id: string

Set the id of the widget's DOM node.

isAttached

isAttached: boolean

Test whether the widget's node is attached to the DOM.

isDisposed

isDisposed: boolean

Test whether the widget has been disposed.

isHidden

isHidden: boolean

Test whether the widget is explicitly hidden.

isVisible

isVisible: boolean

Test whether the widget is visible.

Notes

A widget is visible when it is attached to the DOM, is not explicitly hidden, and has no explicitly hidden ancestors.

layout

layout: Layout | null

Set the layout for the widget.

Notes

The layout is single-use only. It cannot be changed after the first assignment.

The layout is disposed automatically when the widget is disposed.

node

node: HTMLElement

Get the DOM node owned by the widget.

parent

parent: Widget | null

Set the parent of the widget.

Notes

Children are typically added to a widget by using a layout, which means user code will not normally set the parent widget directly.

The widget will be automatically removed from its old parent.

This is a no-op if there is no effective parent change.

title

title: Title<Widget>

The title object for the widget.

Notes

The title object is used by some container widgets when displaying the widget alongside some title, such as a tab panel or side bar.

Since not all widgets will use the title, it is created on demand.

The owner property of the title is set to this widget.

Accessors

bodyHeight

  • get bodyHeight(): number

bodyWidth

  • get bodyWidth(): number

Protected canvasGC

  • get canvasGC(): CanvasRenderingContext2D

cellRenderers

Protected columnHeaderSections

Protected columnSections

copyConfig

dataModel

defaultSizes

editable

  • get editable(): boolean
  • Whether the grid cells are editable.

    editingEnabled flag must be on and grid must have required selection model, editor controller and data model properties.

    Returns boolean

editingEnabled

  • get editingEnabled(): boolean
  • set editingEnabled(enabled: boolean): void

editorController

headerHeight

  • get headerHeight(): number

headerVisibility

headerWidth

  • get headerWidth(): number

keyHandler

maxScrollX

  • get maxScrollX(): number

maxScrollY

  • get maxScrollY(): number

minimumSizes

mouseHandler

pageHeight

  • get pageHeight(): number

pageWidth

  • get pageWidth(): number

Protected rowHeaderSections

Protected rowSections

scrollX

  • get scrollX(): number

scrollY

  • get scrollY(): number

selectionModel

stretchLastColumn

  • get stretchLastColumn(): boolean
  • set stretchLastColumn(value: boolean): void

stretchLastRow

  • get stretchLastRow(): boolean
  • set stretchLastRow(value: boolean): void

style

  • get style(): Style
  • set style(value: Style): void

totalHeight

  • get totalHeight(): number

totalWidth

  • get totalWidth(): number

viewport

  • get viewport(): Widget

viewportHeight

  • get viewportHeight(): number

viewportWidth

  • get viewportWidth(): number

Methods

Private _blitContent

  • _blitContent(source: HTMLCanvasElement, x: number, y: number, w: number, h: number, dx: number, dy: number): void
  • Blit content into the on-screen grid canvas.

    The rect should be expressed in viewport coordinates.

    This automatically accounts for the dpi ratio.

    Parameters

    • source: HTMLCanvasElement
    • x: number
    • y: number
    • w: number
    • h: number
    • dx: number
    • dy: number

    Returns void

Private _drawBackground

  • _drawBackground(rgn: Private.PaintRegion, color: string | undefined): void
  • Draw the background for the given paint region.

    Parameters

    • rgn: Private.PaintRegion
    • color: string | undefined

    Returns void

Private _drawBodyRegion

  • _drawBodyRegion(rx: number, ry: number, rw: number, rh: number): void
  • Draw the body region which intersects the dirty rect.

    Parameters

    • rx: number
    • ry: number
    • rw: number
    • rh: number

    Returns void

Private _drawBodySelections

  • _drawBodySelections(): void

Private _drawCells

  • _drawCells(rgn: Private.PaintRegion): void

Private _drawColumnBackground

  • _drawColumnBackground(rgn: Private.PaintRegion, colorFn: function | undefined): void
  • Draw the column background for the given paint region.

    Parameters

    • rgn: Private.PaintRegion
    • colorFn: function | undefined

    Returns void

Private _drawColumnHeaderRegion

  • _drawColumnHeaderRegion(rx: number, ry: number, rw: number, rh: number): void
  • Draw the column header region which intersects the dirty rect.

    Parameters

    • rx: number
    • ry: number
    • rw: number
    • rh: number

    Returns void

Private _drawColumnHeaderSelections

  • _drawColumnHeaderSelections(): void

Private _drawCursor

  • _drawCursor(): void

Private _drawHorizontalGridLines

  • _drawHorizontalGridLines(rgn: Private.PaintRegion, color: string | undefined): void
  • Draw the horizontal grid lines for the given paint region.

    Parameters

    • rgn: Private.PaintRegion
    • color: string | undefined

    Returns void

Private _drawRowBackground

  • _drawRowBackground(rgn: Private.PaintRegion, colorFn: function | undefined): void
  • Draw the row background for the given paint region.

    Parameters

    • rgn: Private.PaintRegion
    • colorFn: function | undefined

    Returns void

Private _drawRowHeaderRegion

  • _drawRowHeaderRegion(rx: number, ry: number, rw: number, rh: number): void
  • Draw the row header region which intersects the dirty rect.

    Parameters

    • rx: number
    • ry: number
    • rw: number
    • rh: number

    Returns void

Private _drawRowHeaderSelections

  • _drawRowHeaderSelections(): void

Private _drawShadows

  • _drawShadows(): void

Private _drawVerticalGridLines

  • _drawVerticalGridLines(rgn: Private.PaintRegion, color: string | undefined): void
  • Draw the vertical grid lines for the given paint region.

    Parameters

    • rgn: Private.PaintRegion
    • color: string | undefined

    Returns void

Private _drawVoidRegion

  • _drawVoidRegion(rx: number, ry: number, rw: number, rh: number): void
  • Draw the void region for the dirty rect.

    Parameters

    • rx: number
    • ry: number
    • rw: number
    • rh: number

    Returns void

Private _evtContextMenu

  • _evtContextMenu(event: MouseEvent): void

Private _evtKeyDown

  • _evtKeyDown(event: KeyboardEvent): void

Private _evtMouseDoubleClick

  • _evtMouseDoubleClick(event: MouseEvent): void

Private _evtMouseDown

  • _evtMouseDown(event: MouseEvent): void

Private _evtMouseLeave

  • _evtMouseLeave(event: MouseEvent): void

Private _evtMouseMove

  • _evtMouseMove(event: MouseEvent): void

Private _evtMouseUp

  • _evtMouseUp(event: MouseEvent): void

Private _evtWheel

  • _evtWheel(event: WheelEvent): void

Private _fitBodyColumnHeaders

  • _fitBodyColumnHeaders(dataModel: DataModel, padding: number, numCols?: undefined | number): void
  • Resizes body column headers so their text fits without clipping or wrapping.

    Parameters

    • dataModel: DataModel
    • padding: number
    • Optional numCols: undefined | number

    Returns void

Private _fitRowColumnHeaders

  • _fitRowColumnHeaders(dataModel: DataModel, padding: number, numCols?: undefined | number): void
  • Resizes row header columns so their text fits without clipping or wrapping.

    Parameters

    • dataModel: DataModel
    • padding: number
    • Optional numCols: undefined | number

    Returns void

Private _getColumnSize

  • _getColumnSize(region: CellRegion, index: number): number

Private _getRowSize

  • _getRowSize(region: CellRegion, index: number): number

Private _onCellsChanged

Private _onColumnsInserted

Private _onColumnsMoved

Private _onColumnsRemoved

Private _onDataModelChanged

Private _onModelReset

Private _onPageRequested

  • _onPageRequested(sender: ScrollBar, dir: "decrement" | "increment"): void
  • Handle the pageRequested signal from a scroll bar.

    Parameters

    • sender: ScrollBar
    • dir: "decrement" | "increment"

    Returns void

Private _onRenderersChanged

  • _onRenderersChanged(): void

Private _onRowsInserted

Private _onRowsMoved

Private _onRowsRemoved

Private _onSelectionsChanged

Private _onStepRequested

  • _onStepRequested(sender: ScrollBar, dir: "decrement" | "increment"): void
  • Handle the stepRequested signal from a scroll bar.

    Parameters

    • sender: ScrollBar
    • dir: "decrement" | "increment"

    Returns void

Private _onThumbMoved

  • _onThumbMoved(sender: ScrollBar): void

Private _onViewportColumnResizeRequest

  • _onViewportColumnResizeRequest(msg: ColumnResizeRequest): void
  • A message hook invoked on a viewport 'column-resize-request' message.

    Parameters

    • msg: ColumnResizeRequest

    Returns void

Private _onViewportOverlayPaintRequest

  • _onViewportOverlayPaintRequest(msg: Message): void
  • A message hook invoked on a viewport 'overlay-paint-request' message.

    Parameters

    • msg: Message

    Returns void

Private _onViewportPaintRequest

  • _onViewportPaintRequest(msg: PaintRequest): void
  • A message hook invoked on a viewport 'paint-request' message.

    Parameters

    • msg: PaintRequest

    Returns void

Private _onViewportResize

  • _onViewportResize(msg: ResizeMessage): void

Private _onViewportRowResizeRequest

  • _onViewportRowResizeRequest(msg: RowResizeRequest): void
  • A message hook invoked on a viewport 'row-resize-request' message.

    Parameters

    • msg: RowResizeRequest

    Returns void

Private _onViewportScrollRequest

  • _onViewportScrollRequest(msg: Message): void

Private _paintOverlay

  • _paintOverlay(): void
  • Paint the overlay content for the entire grid.

    This is the primary overlay paint entry point. The individual _draw* methods should not be invoked directly. This method dispatches to the drawing methods in the correct order.

    Returns void

Private _processViewportMessage

  • _processViewportMessage(msg: Message): void

Private _refreshDPI

  • _refreshDPI(): void

Private _releaseMouse

  • _releaseMouse(): void

Private _resizeCanvasIfNeeded

  • _resizeCanvasIfNeeded(width: number, height: number): void
  • Ensure the canvas is at least the specified size.

    This method will retain the valid canvas content.

    Parameters

    • width: number
    • height: number

    Returns void

Private _resizeColumn

  • _resizeColumn(index: number, size: number): void

Private _resizeColumnHeader

  • _resizeColumnHeader(index: number, size: number): void

Private _resizeRow

  • _resizeRow(index: number, size: number): void

Private _resizeRowHeader

  • _resizeRowHeader(index: number, size: number): void

Private _scrollTo

  • _scrollTo(x: number, y: number): void

Private _syncScrollState

  • _syncScrollState(): void
  • Sync the scroll bars and scroll state with the viewport.

    Notes

    If the visibility of either scroll bar changes, a synchronous fit-request will be dispatched to the data grid to immediately resize the viewport.

    Returns void

Private _syncViewport

  • _syncViewport(): void

activate

  • activate(): void
  • Post an 'activate-request' message to the widget.

    Notes

    This is a simple convenience method for posting the message.

    Returns void

addClass

  • addClass(name: string): void
  • Add a class name to the widget's DOM node.

    Parameters

    • name: string

      The class name to add to the node.

      Notes

      If the class name is already added to the node, this is a no-op.

      The class name must not contain whitespace.

    Returns void

children

  • children(): IIterator<Widget>
  • Create an iterator over the widget's children.

    Returns IIterator<Widget>

    A new iterator over the children of the widget.

    Notes

    The widget must have a populated layout in order to have children.

    If a layout is not installed, the returned iterator will be empty.

clearFlag

  • clearFlag(flag: Flag): void
  • Clear the given widget flag.

    Notes

    This will not typically be called directly by user code.

    Parameters

    • flag: Flag

    Returns void

close

  • close(): void
  • Send a 'close-request' message to the widget.

    Notes

    This is a simple convenience method for sending the message.

    Returns void

columnAt

  • Get the column at a virtual offset in the data grid.

    Parameters

    • region: ColumnRegion

      The region which holds the column of interest.

    • offset: number

      The virtual offset of the column of interest.

    Returns number

    The index of the column, or -1 if the offset is out of range.

    Notes

    This method accounts for a stretched last column.

columnCount

  • Get the column count for a particular region in the data grid.

    Parameters

    Returns number

    The column count for the specified region.

columnOffset

  • Get the offset of a column in the data grid.

    Parameters

    • region: ColumnRegion

      The region which holds the column of interest.

    • index: number

      The index of the column of interest.

    Returns number

    The offset of the column, or -1 if the index is out of range.

    Notes

    A stretched last column has no effect on the return value.

columnSize

  • Get the size of a column in the data grid.

    Parameters

    • region: ColumnRegion

      The region which holds the column of interest.

    • index: number

      The index of the column of interest.

    Returns number

    The size of the column, or -1 if the index is out of range.

    Notes

    This method accounts for a stretched last column.

contains

  • contains(widget: Widget): boolean
  • Test whether a widget is a descendant of this widget.

    Parameters

    • widget: Widget

      The descendant widget of interest.

    Returns boolean

    true if the widget is a descendant, false otherwise.

copyToClipboard

  • copyToClipboard(): void
  • Copy the current selection to the system clipboard.

    Notes

    The grid must have a data model and a selection model.

    The behavior can be configured via DataGrid.copyConfig.

    Returns void

dispose

  • dispose(): void

Protected drawCornerHeaderRegion

  • drawCornerHeaderRegion(rx: number, ry: number, rw: number, rh: number): void
  • Draw the corner header region which intersects the dirty rect.

    Parameters

    • rx: number
    • ry: number
    • rw: number
    • rh: number

    Returns void

fit

  • fit(): void
  • Post a 'fit-request' message to the widget.

    Notes

    This is a simple convenience method for posting the message.

    Returns void

fitColumnNames

  • fitColumnNames(area?: ColumnFitType, padding?: number, numCols?: undefined | number): void
  • Auto sizes column widths based on their text content.

    Parameters

    • Default value area: ColumnFitType = "all"

      which area to resize: 'body', 'row-header' or 'all'.

    • Default value padding: number = 15

      padding added to resized columns (pixels).

    • Optional numCols: undefined | number

      specify cap on the number of column resizes (optional).

    Returns void

handleEvent

  • handleEvent(event: Event): void
  • Handle the DOM events for the data grid.

    Parameters

    • event: Event

      The DOM event sent to the data grid.

      Notes

      This method implements the DOM EventListener interface and is called in response to events on the data grid's DOM node. It should not be called directly by user code.

    Returns void

hasClass

  • hasClass(name: string): boolean
  • Test whether the widget's DOM node has the given class name.

    Parameters

    • name: string

      The class name of interest.

    Returns boolean

    true if the node has the class, false otherwise.

hide

  • hide(): void
  • Hide the widget and make it hidden to its parent widget.

    Notes

    This causes the isHidden property to be true.

    If the widget is explicitly hidden, this is a no-op.

    Returns void

hitTest

  • Hit test the viewport for the given client position.

    Parameters

    • clientX: number

      The client X position of the mouse.

    • clientY: number

      The client Y position of the mouse.

    Returns HitTestResult

    The hit test result, or null if the client position is out of bounds.

    Notes

    This method accounts for a stretched last row and/or column.

mapToLocal

  • mapToLocal(clientX: number, clientY: number): object
  • Map a client position to local viewport coordinates.

    Parameters

    • clientX: number

      The client X position of the mouse.

    • clientY: number

      The client Y position of the mouse.

    Returns object

    The local viewport coordinates for the position.

mapToVirtual

  • mapToVirtual(clientX: number, clientY: number): object
  • Map a client position to virtual grid coordinates.

    Parameters

    • clientX: number

      The client X position of the mouse.

    • clientY: number

      The client Y position of the mouse.

    Returns object

    The virtual grid coordinates for the position.

messageHook

  • messageHook(handler: IMessageHandler, msg: Message): boolean
  • Intercept a message sent to a message handler.

    Parameters

    • handler: IMessageHandler

      The target handler of the message.

    • msg: Message

      The message to be sent to the handler.

    Returns boolean

    true if the message should continue to be processed as normal, or false if processing should cease immediately.

moveCursor

Protected notifyLayout

  • notifyLayout(msg: Message): void
  • Invoke the message processing routine of the widget's layout.

    Parameters

    • msg: Message

      The message to dispatch to the layout.

      Notes

      This is a no-op if the widget does not have a layout.

      This will not typically be called directly by user code.

    Returns void

Protected onActivateRequest

  • onActivateRequest(msg: Message): void
  • A message handler invoked on an 'activate-request' message.

    Parameters

    • msg: Message

    Returns void

Protected onAfterAttach

  • onAfterAttach(msg: Message): void
  • A message handler invoked on an 'after-attach' message.

    Notes

    The default implementation of this handler is a no-op.

    Parameters

    • msg: Message

    Returns void

Protected onAfterDetach

  • onAfterDetach(msg: Message): void
  • A message handler invoked on an 'after-detach' message.

    Parameters

    • msg: Message

    Returns void

Protected onAfterHide

  • onAfterHide(msg: Message): void
  • A message handler invoked on an 'after-hide' message.

    Notes

    The default implementation of this handler is a no-op.

    Parameters

    • msg: Message

    Returns void

Protected onAfterShow

  • onAfterShow(msg: Message): void
  • A message handler invoked on an 'after-show' message.

    Notes

    The default implementation of this handler is a no-op.

    Parameters

    • msg: Message

    Returns void

Protected onBeforeAttach

  • onBeforeAttach(msg: Message): void
  • A message handler invoked on a 'before-attach' message.

    Parameters

    • msg: Message

    Returns void

Protected onBeforeDetach

  • onBeforeDetach(msg: Message): void
  • A message handler invoked on a 'before-detach' message.

    Notes

    The default implementation of this handler is a no-op.

    Parameters

    • msg: Message

    Returns void

Protected onBeforeHide

  • onBeforeHide(msg: Message): void
  • A message handler invoked on a 'before-hide' message.

    Notes

    The default implementation of this handler is a no-op.

    Parameters

    • msg: Message

    Returns void

Protected onBeforeShow

  • onBeforeShow(msg: Message): void
  • A message handler invoked on a 'before-show' message.

    Parameters

    • msg: Message

    Returns void

Protected onChildAdded

  • onChildAdded(msg: ChildMessage): void
  • A message handler invoked on a 'child-added' message.

    Notes

    The default implementation of this handler is a no-op.

    Parameters

    • msg: ChildMessage

    Returns void

Protected onChildRemoved

  • onChildRemoved(msg: ChildMessage): void
  • A message handler invoked on a 'child-removed' message.

    Notes

    The default implementation of this handler is a no-op.

    Parameters

    • msg: ChildMessage

    Returns void

Protected onCloseRequest

  • onCloseRequest(msg: Message): void
  • A message handler invoked on a 'close-request' message.

    Notes

    The default implementation unparents or detaches the widget.

    Parameters

    • msg: Message

    Returns void

Protected onFitRequest

  • onFitRequest(msg: Message): void
  • A message handler invoked on a 'fit-request' message.

    Notes

    The default implementation of this handler is a no-op.

    Parameters

    • msg: Message

    Returns void

Protected onResize

  • onResize(msg: ResizeMessage): void
  • A message handler invoked on a 'resize' message.

    Parameters

    • msg: ResizeMessage

    Returns void

Protected onUpdateRequest

  • onUpdateRequest(msg: Message): void
  • A message handler invoked on an 'update-request' message.

    Notes

    The default implementation of this handler is a no-op.

    Parameters

    • msg: Message

    Returns void

Protected paintContent

  • paintContent(rx: number, ry: number, rw: number, rh: number): void
  • Paint the grid content for the given dirty rect.

    The rect should be expressed in valid viewport coordinates.

    This is the primary paint entry point. The individual _draw* methods should not be invoked directly. This method dispatches to the drawing methods in the correct order.

    Parameters

    • rx: number
    • ry: number
    • rw: number
    • rh: number

    Returns void

processMessage

  • processMessage(msg: Message): void
  • Process a message sent to the widget.

    Parameters

    • msg: Message

      The message sent to the widget.

    Returns void

removeClass

  • removeClass(name: string): void
  • Remove a class name from the widget's DOM node.

    Parameters

    • name: string

      The class name to remove from the node.

      Notes

      If the class name is not yet added to the node, this is a no-op.

      The class name must not contain whitespace.

    Returns void

Protected repaintContent

  • repaintContent(): void

Protected repaintOverlay

  • repaintOverlay(): void

Protected repaintRegion

  • repaintRegion(region: CellRegion, r1: number, c1: number, r2: number, c2: number): void

resetColumns

resetRows

resizeColumn

  • resizeColumn(region: ColumnRegion, index: number, size: number): void
  • Resize a column in the data grid.

    Parameters

    • region: ColumnRegion

      The region which holds the column of interest.

    • index: number

      The index of the column of interest.

    • size: number

      The desired size of the column.

    Returns void

resizeRow

  • resizeRow(region: RowRegion, index: number, size: number): void
  • Resize a row in the data grid.

    Parameters

    • region: RowRegion

      The region which holds the row of interest.

    • index: number

      The index of the row of interest.

    • size: number

      The desired size of the row.

    Returns void

rowAt

  • rowAt(region: RowRegion, offset: number): number
  • Get the row at a virtual offset in the data grid.

    Parameters

    • region: RowRegion

      The region which holds the row of interest.

    • offset: number

      The virtual offset of the row of interest.

    Returns number

    The index of the row, or -1 if the offset is out of range.

    Notes

    This method accounts for a stretched last row.

rowCount

  • Get the row count for a particular region in the data grid.

    Parameters

    • region: RowRegion

      The row region of interest.

    Returns number

    The row count for the specified region.

rowOffset

  • rowOffset(region: RowRegion, index: number): number
  • Get the offset of a row in the data grid.

    Parameters

    • region: RowRegion

      The region which holds the row of interest.

    • index: number

      The index of the row of interest.

    Returns number

    The offset of the row, or -1 if the index is out of range.

    Notes

    A stretched last row has no effect on the return value.

rowSize

  • rowSize(region: RowRegion, index: number): number
  • Get the size of a row in the data grid.

    Parameters

    • region: RowRegion

      The region which holds the row of interest.

    • index: number

      The index of the row of interest.

    Returns number

    The size of the row, or -1 if the index is out of range.

    Notes

    This method accounts for a stretched last row.

scrollBy

  • scrollBy(dx: number, dy: number): void
  • Scroll the viewport by the specified amount.

    Parameters

    • dx: number

      The X scroll amount.

    • dy: number

      The Y scroll amount.

    Returns void

scrollByPage

  • scrollByPage(dir: "up" | "down" | "left" | "right"): void
  • Scroll the viewport by one page.

    Parameters

    • dir: "up" | "down" | "left" | "right"

      The desired direction of the scroll.

    Returns void

scrollByStep

  • scrollByStep(dir: "up" | "down" | "left" | "right"): void
  • Scroll the viewport by one cell-aligned step.

    Parameters

    • dir: "up" | "down" | "left" | "right"

      The desired direction of the scroll.

    Returns void

scrollTo

  • scrollTo(x: number, y: number): void
  • Scroll to the specified offset position.

    Parameters

    • x: number

      The desired X position.

    • y: number

      The desired Y position.

    Returns void

scrollToCell

  • scrollToCell(row: number, column: number): void
  • Scroll the grid to the specified cell.

    Parameters

    • row: number

      The row index of the cell.

    • column: number

      The column index of the cell.

      Notes

      This is a no-op if the cell is already visible.

    Returns void

scrollToColumn

  • scrollToColumn(column: number): void
  • Scroll the grid to the specified column.

    Parameters

    • column: number

      The column index of the cell.

      Notes

      This is a no-op if the column is already visible.

    Returns void

scrollToCursor

  • scrollToCursor(): void
  • Scroll the grid to the current cursor position.

    Notes

    This is a no-op if the cursor is already visible or if there is no selection model installed on the grid.

    Returns void

scrollToRow

  • scrollToRow(row: number): void
  • Scroll the grid to the specified row.

    Parameters

    • row: number

      The row index of the cell.

      Notes

      This is a no-op if the row is already visible.

    Returns void

setFlag

  • setFlag(flag: Flag): void
  • Set the given widget flag.

    Notes

    This will not typically be called directly by user code.

    Parameters

    • flag: Flag

    Returns void

setHidden

  • setHidden(hidden: boolean): void
  • Show or hide the widget according to a boolean value.

    Parameters

    • hidden: boolean

      true to hide the widget, or false to show it.

      Notes

      This is a convenience method for hide() and show().

    Returns void

show

  • show(): void
  • Show the widget and make it visible to its parent widget.

    Notes

    This causes the isHidden property to be false.

    If the widget is not explicitly hidden, this is a no-op.

    Returns void

testFlag

  • testFlag(flag: Flag): boolean
  • Test whether the given widget flag is set.

    Notes

    This will not typically be called directly by user code.

    Parameters

    • flag: Flag

    Returns boolean

toggleClass

  • toggleClass(name: string, force?: undefined | false | true): boolean
  • Toggle a class name on the widget's DOM node.

    Parameters

    • name: string

      The class name to toggle on the node.

    • Optional force: undefined | false | true

      Whether to force add the class (true) or force remove the class (false). If not provided, the presence of the class will be toggled from its current state.

    Returns boolean

    true if the class is now present, false otherwise.

    Notes

    The class name must not contain whitespace.

update

  • update(): void
  • Post an 'update-request' message to the widget.

    Notes

    This is a simple convenience method for posting the message.

    Returns void

Static attach

  • attach(widget: Widget, host: HTMLElement, ref?: HTMLElement | null): void
  • Attach a widget to a host DOM node.

    Parameters

    • widget: Widget

      The widget of interest.

    • host: HTMLElement

      The DOM node to use as the widget's host.

    • Optional ref: HTMLElement | null

      The child of host to use as the reference element. If this is provided, the widget will be inserted before this node in the host. The default is null, which will cause the widget to be added as the last child of the host.

      Notes

      This will throw an error if the widget is not a root widget, if the widget is already attached, or if the host is not attached to the DOM.

    Returns void

Static copyFormatGeneric

  • A generic format function for the copy handler.

    Parameters

    Returns string

    The string representation of the value.

    Notes

    This function uses String() to coerce a value to a string.

Static detach

  • detach(widget: Widget): void
  • Detach the widget from its host DOM node.

    Parameters

    • widget: Widget

      The widget of interest.

      Notes

      This will throw an error if the widget is not a root widget, or if the widget is not attached to the DOM.

    Returns void

Object literals

Static defaultCopyConfig

defaultCopyConfig: object

The default copy config for a data grid.

format

format: copyFormatGeneric = copyFormatGeneric

headers

headers: "none" = "none"

separator

separator: string = " "

warningThreshold

warningThreshold: number = 1000000

Static defaultSizes

defaultSizes: object

The default sizes for a data grid.

columnHeaderHeight

columnHeaderHeight: number = 20

columnWidth

columnWidth: number = 64

rowHeaderWidth

rowHeaderWidth: number = 64

rowHeight

rowHeight: number = 20

Static defaultStyle

defaultStyle: object

The default theme for a data grid.

backgroundColor

backgroundColor: string = "#FFFFFF"

cursorBorderColor

cursorBorderColor: string = "rgba(0, 107, 247, 1.0)"

gridLineColor

gridLineColor: string = "rgba(20, 20, 20, 0.15)"

headerBackgroundColor

headerBackgroundColor: string = "#F3F3F3"

headerGridLineColor

headerGridLineColor: string = "rgba(20, 20, 20, 0.25)"

headerSelectionBorderColor

headerSelectionBorderColor: string = "rgba(0, 107, 247, 1.0)"

headerSelectionFillColor

headerSelectionFillColor: string = "rgba(20, 20, 20, 0.1)"

selectionBorderColor

selectionBorderColor: string = "rgba(0, 107, 247, 1.0)"

selectionFillColor

selectionFillColor: string = "rgba(49, 119, 229, 0.2)"

voidColor

voidColor: string = "#F3F3F3"

scrollShadow

scrollShadow: object

color1

color1: string = "rgba(0, 0, 0, 0.20)"

color2

color2: string = "rgba(0, 0, 0, 0.05)"

color3

color3: string = "rgba(0, 0, 0, 0.00)"

size

size: number = 10

Static minimumSizes

minimumSizes: object

The default minimum sizes for a data grid.

columnHeaderHeight

columnHeaderHeight: number = 20

columnWidth

columnWidth: number = 10

rowHeaderWidth

rowHeaderWidth: number = 10

rowHeight

rowHeight: number = 20

Generated using TypeDoc