A data model implementation for in-memory delimiter-separated data.

Notes

This model handles data with up to 2**32 characters.

Hierarchy

  • DataModel
    • DSVModel

Implements

Constructors

  • Create a data model with static CSV data.

    Parameters

    Returns DSVModel

Properties

_columnCount: any
_columnOffsets: any

The column offset cache, starting with row _columnOffsetsStartingRow

Notes

The index of the first character in the data string for row r, column c is _columnOffsets[(r-this._columnOffsetsStartingRow)*numColumns+c]

_columnOffsetsStartingRow: any

The row that _columnOffsets[0] represents.

_computeRowOffsets: any

Compute the row offsets and initialize the column offset cache.

Param

The last row to parse, from the start of the data (first row is row 1).

Notes

This method supports parsing the data incrementally by calling it with incrementally higher endRow. Rows that have already been parsed will not be parsed again.

_delayedParse: any
_delimiter: any
_doneParsing: any
_getField: any

Get the parsed string field for a row and column.

Param

The row number of the data item.

Param

The column number of the data item.

Returns

The parsed string for the data item.

_header: any

The header strings.

_initialRows: any

The number of rows to parse initially before doing a delayed parse of the entire data.

_isDisposed: any
_maxCacheGet: any

The maximum number of rows to parse when there is a cache miss.

_parser: any
_quote: any
_quoteEscaped: any
_rawData: any
_ready: any
_resetParser: any

Reset the parser state.

_rowCount: any
_rowDelimiter: any
_rowOffsets: any

The index for the start of each row.

_startedParsing: any

Accessors

  • get changed(): ISignal<this, ChangedArgs>
  • A signal emitted when the data model has changed.

    Returns ISignal<this, ChangedArgs>

  • get delimiter(): string
  • The delimiter between entries on the same row.

    Returns string

  • get doneParsing(): boolean
  • A boolean determined by whether parsing has completed.

    Returns boolean

  • get header(): string[]
  • The header strings.

    Returns string[]

  • set header(value): void
  • Parameters

    • value: string[]

    Returns void

  • get initialRows(): number
  • The initial chunk of rows to parse.

    Returns number

  • set initialRows(value): void
  • Parameters

    • value: number

    Returns void

  • get isDisposed(): boolean
  • Whether this model has been disposed.

    Returns boolean

  • get rawData(): string
  • The string representation of the data.

    Returns string

  • set rawData(value): void
  • Parameters

    • value: string

    Returns void

  • get ready(): Promise<void>
  • A promise that resolves when the model has parsed all of its data.

    Returns Promise<void>

  • get rowDelimiter(): string
  • The delimiter between rows.

    Returns string

Methods

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

    Parameters

    • region: ColumnRegion

      The column region of interest.

    Returns number

    • The column count for the region.
  • 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 string

  • Dispose the resources held by this model.

    Returns void

  • 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

    • args: ChangedArgs

    Returns void

  • Get the index in the data string for the first character of a row and column.

    Parameters

    • row: number

      The row of the data item.

    • column: number

      The column of the data item.

    Returns number

    • The index into the data string where the data item starts.
  • 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

    a cell group.

  • Get the count of merged cell groups pertaining to a given cell region.

    Parameters

    • region: CellRegion

      the target cell region.

    Returns number

  • 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 {}.

  • Parse the data string asynchronously.

    Notes

    It can take several seconds to parse a several hundred megabyte string, so we parse the first 500 rows to get something up on the screen, then we parse the full data string asynchronously.

    Returns void

  • 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.

Generated using TypeDoc