Class SelectionModelAbstract

A base class for creating data grid selection models.

Notes

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

Hierarchy (view full)

Constructors

Properties

_changed: Signal<SelectionModel, void> = ...
_selectionMode: SelectionMode = 'cell'
cursorColumn: number

The column index of the cursor.

This is -1 if the selection model is empty.

cursorRow: number

The row index of the cursor.

This is -1 if the selection model is empty.

dataModel: DataModel

The data model associated with the selection model.

isEmpty: boolean

Whether the selection model is empty.

Notes

An empty selection model will yield an empty selections iterator.

Accessors

Methods

  • Emit the changed signal for the selection model.

    Notes

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

    Returns void

  • Test whether any selection intersects a cell.

    Parameters

    • row: number

      The row index of interest.

    • column: number

      The column index of interest.

    Returns boolean

    Whether any selection intersects the cell.

    Notes

    This method may be reimplemented in a subclass.

  • Test whether any selection intersects a column.

    Parameters

    • index: number

      The column index of interest.

    Returns boolean

    Whether any selection intersects the column.

    Notes

    This method may be reimplemented in a subclass.

  • Test whether any selection intersects a row.

    Parameters

    • index: number

      The row index of interest.

    Returns boolean

    Whether any selection intersects the row.

    Notes

    This method may be reimplemented in a subclass.

  • Move cursor down/up/left/right while making sure it remains within the bounds of selected rectangles

    Parameters

    Returns void

  • A signal handler for the data model changed signal.

    Parameters

    • sender: DataModel
    • args: ChangedArgs

      The arguments for the signal.

      Notes

      Selection model implementations should update their selections in a manner that is relevant for the changes to the data model.

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

    Returns void