Options
All
  • Public
  • Public/Protected
  • All
Menu

Class DataModel

An object which provides the data for a data grid. The namespace for the DataModel class statics.

Notes

If the predefined data models are insufficient for a particular use case, a custom model can be defined which derives from this class.

Hierarchy

Index

Type aliases

Static CellRegion

CellRegion: "body" | "row-header" | "column-header" | "corner-header"

A type alias for the data model cell regions.

Static CellsChangedArgs

CellsChangedArgs: object

An arguments object for the changed signal.

Notes

Data models should emit the changed signal with this args object type when cells are changed in-place.

Type declaration

Static ChangedArgs

A type alias for the args objects of the changed signal.

Static ColumnRegion

ColumnRegion: "body" | "row-header"

A type alias for the data model column regions.

Static ColumnsChangedArgs

ColumnsChangedArgs: object

An arguments object for the changed signal.

Notes

Data models should emit the changed signal with this args object type when columns are inserted or removed.

Type declaration

Static ColumnsMovedArgs

ColumnsMovedArgs: object

An arguments object for the changed signal.

Notes

Data models should emit the changed signal with this args object type when columns are moved.

Type declaration

Static Metadata

Metadata: object

The metadata for a column in a data model.

Type declaration

  • [key: string]: any

Static ModelResetArgs

ModelResetArgs: object

An arguments object for the changed signal.

Notes

Data models should emit the changed signal with this args object type when the model has changed in a fashion that cannot be easily expressed by the other args object types.

This is the "big hammer" approach, and will cause any associated data grid to perform a full reset. The other changed args types should be used whenever possible.

Type declaration

Static RowRegion

RowRegion: "body" | "column-header"

A type alias for the data model row regions.

Static RowsChangedArgs

RowsChangedArgs: object

An arguments object for the changed signal.

Notes

Data models should emit the changed signal with this args object type when rows are inserted or removed.

Type declaration

Static RowsMovedArgs

RowsMovedArgs: object

An arguments object for the changed signal.

Notes

Data models should emit the changed signal with this args object type when rows are moved.

Type declaration

Properties

Private _changed

_changed: Signal<this, object | object | object | object | object | object> = new Signal<this, DataModel.ChangedArgs>(this)

Static emptyMetadata

emptyMetadata: Metadata = Object.freeze({})

A singleton empty metadata object.

Accessors

changed

Methods

Abstract columnCount

  • Get the column count for a region in the data model.

    Parameters

    Returns number

    • The column count for the region.

    Notes

    This method is called often, and so should be efficient.

Abstract data

  • data(region: CellRegion, row: number, column: number): any
  • Get the data value for a cell in the data model.

    Parameters

    • region: CellRegion

      The cell region of interest.

    • row: number

      The row index of the cell of interest.

    • column: number

      The column index of the cell of interest.

    Returns any

    The data value for the specified cell.

    Notes

    The returned data should be treated as immutable.

    This method is called often, and so should be efficient.

Protected emitChanged

  • Emit the changed signal for the data model.

    Notes

    Subclasses should call this method whenever the data model has changed so that attached data grids can update themselves.

    Parameters

    Returns void

group

  • Get the merged cell group corresponding to a region and index number.

    Parameters

    • region: CellRegion

      the cell region of cell group.

    • groupIndex: number

      the group index of the cell group.

    Returns CellGroup | null

    a cell group.

groupCount

metadata

  • Get the metadata for a cell in the data model.

    Parameters

    • region: CellRegion

      The cell region of interest.

    • row: number

      The row index of the cell of interest.

    • column: number

      The column index of the cell of interest.

    Returns Metadata

    The metadata for the specified cell.

    Notes

    The returned metadata should be treated as immutable.

    This method is called often, and so should be efficient.

    The default implementation returns {}.

Abstract rowCount

  • Get the row count for a region in the data model.

    Parameters

    • region: RowRegion

      The row region of interest.

    Returns number

    • The row count for the region.

    Notes

    This method is called often, and so should be efficient.

Generated using TypeDoc