Highcharts Dashboards
    Preparing search index...

    Class to manage columns and rows in a table structure. It provides methods to add, remove, and manipulate columns and rows, as well as to retrieve data from specific cells.

    Highcharts.DataTable

    Options to initialize the new DataTable instance.

    Hierarchy

    • DataTableCore
      • DataTable

    Implements

    Index

    Constructors

    Properties

    autoId: boolean
    columns: Record<string, Column>
    id: string
    metadata?: Record<string, DataTableValue>
    modified?: DataTable
    rowCount: number
    versionTag: string

    Methods

    • Function

      Changes the ID of an existing column to a new ID, effectively renaming the column.

      Highcharts.DataTable#changeColumnId

      Parameters

      • columnId: string

        Id of the column to be changed.

      • newColumnId: string

        New id of the column.

      Returns boolean

      Returns true if successful, false if the column was not found.

    • Function

      Returns a clone of this table. The cloned table is completely independent of the original, and any changes made to the clone will not affect the original table.

      Highcharts.DataTable#clone

      Parameters

      • OptionalskipColumns: boolean

        Whether to clone columns or not.

      • OptionaleventDetail: DataEventDetail

        Custom information for pending events.

      Returns DataTable

      Clone of this data table.

      #cloneTable

      #afterCloneTable

    • Function

      Deletes columns from the table.

      Highcharts.DataTable#deleteColumns

      Parameters

      • OptionalcolumnIds: string[]

        Names of columns to delete. If no array is provided, all columns will be deleted.

      • OptionaleventDetail: DataEventDetail

        Custom information for pending events.

      Returns ColumnCollection | undefined

      Returns the deleted columns, if found.

      #deleteColumns

      #afterDeleteColumns

    • Deletes the row index references. This is useful when the original table is deleted, and the references are no longer needed. This table is then considered an original table or a table that has the same rows order as the original table.

      Returns void

    • Function

      Deletes rows in this table.

      Highcharts.DataTable#deleteRows

      Parameters

      • OptionalrowIndex: number | number[]

        Index of the row where deletion should start, or an array of indices for deleting multiple rows. If not specified, all rows will be deleted.

      • OptionalrowCount: number = 1

        Number of rows to delete.

      • OptionaleventDetail: DataEventDetail

        Custom information for pending events.

      Returns Row[]

      Returns the deleted rows, if found.

      #deleteRows

      #afterDeleteRows

    • Function

      Fetches a single cell value.

      Highcharts.DataTable#getCell

      Parameters

      • columnId: string

        Column name of the cell to retrieve.

      • rowIndex: number

        Row index of the cell to retrieve.

      Returns CellType

      Returns the cell value or undefined.

    • Function

      Fetches the given column by the canonical column name. This function is a simplified wrap of getColumns.

      Highcharts.DataTable#getColumn

      Parameters

      • columnId: string

        Name of the column to get.

      • OptionalasReference: boolean

        Whether to return the column as a readonly reference.

      Returns Column | undefined

      A copy of the column, or undefined if not found.

    • Function

      Fetches all column IDs.

      Highcharts.DataTable#getColumnIds

      Returns string[]

      Returns all column IDs.

    • Retrieves all or the given columns. Simplified version of the full DataTable.getColumns method, always returning by reference.

      Parameters

      • OptionalcolumnIds: string[]

        Column ids to retrieve.

      • OptionalasReference: boolean

      Returns ColumnCollection

      Collection of columns. If a requested column was not found, it is undefined.

    • Parameters

      • columnIds: string[] | undefined
      • asReference: true

      Returns Record<string, Column>

    • Parameters

      • columnIds: string[] | undefined
      • asReference: false
      • asBasicColumns: true

      Returns Record<string, BasicColumn>

    • Takes the original row index and returns the local row index in the modified table for which this function is called.

      Parameters

      • originalRowIndex: number

        Original row index to get the local row index for.

      Returns number | undefined

      Returns the local row index or undefined if not found.

    • Returns the modified (clone) or the original data table if the modified one does not exist.

      Returns this

      The modified (clone) or the original data table.

    • Takes the local row index and returns the index of the corresponding row in the original table.

      Parameters

      • rowIndex: number

        Local row index to get the original row index for.

      Returns number | undefined

      Returns the original row index or undefined if not found.

    • Function

      Retrieves the row at a given index. This function is a simplified wrap of getRows.

      Highcharts.DataTable#getRow

      Parameters

      • rowIndex: number

        Row index to retrieve. First row has index 0.

      • OptionalcolumnIds: string[]

        Column names in order to retrieve.

      Returns Row | undefined

      Returns the row values, or undefined if not found.

    • Function

      Returns the number of rows in this table.

      Highcharts.DataTable#getRowCount

      Returns number

      Number of rows in this table.

    • Function

      Retrieves the index of the first row matching a specific cell value.

      Highcharts.DataTable#getRowIndexBy

      Parameters

      • columnId: string

        Column to search in.

      • cellValue: CellType

        Cell value to search for. NaN and undefined are not supported.

      • OptionalrowIndexOffset: number

        Index offset to start searching.

      Returns number | undefined

      Index of the first row matching the cell value.

    • Function

      Retrieves the row at a given index. This function is a simplified wrap of getRowObjects.

      Highcharts.DataTable#getRowObject

      Parameters

      • rowIndex: number

        Row index.

      • OptionalcolumnIds: string[]

        Column names and their order to retrieve.

      Returns RowObject | undefined

      Returns the row values, or undefined if not found.

    • Function

      Fetches all or a number of rows as an object.

      Highcharts.DataTable#getRowObjects

      Parameters

      • OptionalrowIndex: number = 0

        Index of the first row to fetch. Defaults to first row at index 0.

      • OptionalrowCount: number = ...

        Number of rows to fetch. Defaults to maximal number of rows.

      • OptionalcolumnIds: string[]

        Column names and their order to retrieve.

      Returns RowObject[]

      Returns retrieved rows.

    • Function

      Fetches all or a number of rows as an array.

      Highcharts.DataTable#getRows

      Parameters

      • OptionalrowIndex: number = 0

        Index of the first row to fetch. Defaults to first row at index 0.

      • OptionalrowCount: number = ...

        Number of rows to fetch. Defaults to maximal number of rows.

      • OptionalcolumnIds: string[]

        Column names and their order to retrieve.

      Returns Row[]

      Returns retrieved rows.

    • Function

      Returns the unique version tag of the current state of the table.

      Highcharts.DataTable#getVersionTag

      Returns string

      Unique version tag.

    • Function

      Determines whether all specified column names exist in the table.

      Highcharts.DataTable#hasColumns

      Parameters

      • columnIds: string[]

        Column names to check.

      Returns boolean

      Returns true if all columns have been found, otherwise false.

    • Function

      Checks if any row in the specified column contains the given cell value.

      Highcharts.DataTable#hasRowWith

      Parameters

      • columnId: string

        Column to search in.

      • cellValue: CellType

        Cell value to search for. NaN and undefined are not supported.

      Returns boolean

      True, if a row has been found, otherwise false.

    • Function

      Registers a callback function to be executed when a specific event is emitted. To stop listening to the event, call the function returned by this method.

      Highcharts.DataTable#on

      Type Parameters

      • T extends
            | "setModifier"
            | "afterDeleteRows"
            | "afterSetColumns"
            | "afterSetRows"
            | "setCell"
            | "afterSetCell"
            | "cloneTable"
            | "afterCloneTable"
            | "deleteColumns"
            | "afterDeleteColumns"
            | "setColumns"
            | "afterSetModifier"
            | "setModifierError"
            | "deleteRows"
            | "setRows"

      Parameters

      Returns Function

      Function to unregister callback from the event.

    • Function

      Sets the value of a specific cell identified by column ID and row index. If the column does not exist, it will be created. If the row index is beyond the current row count, the table will be expanded to accommodate the new cell.

      Highcharts.DataTable#setCell

      Parameters

      • columnId: string

        Column name to set.

      • rowIndex: number

        Row index to set.

      • cellValue: CellType

        Cell value to set.

      • OptionaleventDetail: DataEventDetail

        Custom information for pending events.

      Returns void

      #setCell

      #afterSetCell

    • Sets cell values for a column. Will insert a new column, if not found.

      Parameters

      • columnId: string

        Column name to set.

      • Optionalcolumn: Column = []

        Values to set in the column.

      • OptionalrowIndex: number = 0

        Index of the first row to change. (Default: 0)

      • OptionaleventDetail: DataEventDetail

        Custom information for pending events.

      Returns void

      #setColumns

      #afterSetColumns

    • Function

      Replaces or updates multiple columns in the table with new data. If a column does not exist, it will be created and added to the table.

      Highcharts.DataTable#setColumns

      Parameters

      • columns: ColumnCollection

        Columns as a collection, where the keys are the column names.

      • OptionalrowIndex: number

        Index of the first row to change. Keep undefined to reset.

      • OptionaleventDetail: DataEventDetail

        Custom information for pending events.

      • OptionaltypeAsOriginal: boolean

        Determines whether the original column retains its type when data replaced. If true, the original column keeps its type. If not (default), the original column will adopt the type of the replacement column.

      Returns void

      #setColumns

      #afterSetColumns

    • Assigns a new data modifier to the table.

      This method does not modify the table directly. Instead, it sets the .modified property of the table with a modified copy of this table, as produced by the modifier.

      Parameters

      • Optionalmodifier: DataModifier

        Modifier to set, or undefined to unset.

      • OptionaleventDetail: DataEventDetail

        Custom information for pending events.

      Returns Promise<DataTable>

      Resolves to this table if successful, or rejects on failure.

      #setModifier

      #afterSetModifier

    • Sets the original row indexes for the table. It is used to keep the reference to the original rows when modifying the table.

      Parameters

      • originalRowIndexes: (number | undefined)[]

        Original row indexes array.

      • omitLocalRowIndexes: boolean = false

        Whether to omit the local row indexes calculation. Defaults to false.

      Returns void

    • Function

      Sets cell values of a row. Will insert a new row, if no index was provided, or if the index is higher than the total number of table rows.

      Note: This function is just a simplified wrap of Highcharts.DataTable#setRows.

      Highcharts.DataTable#setRow

      Parameters

      • row: Row | RowObject

        Cell values to set.

      • OptionalrowIndex: number

        Index of the row to set. Leave undefined to add as a new row.

      • Optionalinsert: boolean

        Whether to insert the row at the given index, or to overwrite the row.

      • OptionaleventDetail: DataEventDetail

        Custom information for pending events.

      Returns void

      #setRows

      #afterSetRows

    • Function

      Sets cell values for multiple rows. Will insert new rows, if no index was was provided, or if the index is higher than the total number of table rows.

      Highcharts.DataTable#setRows

      Parameters

      • rows: (Row | RowObject)[]

        Row values to set.

      • OptionalrowIndex: number = ...

        Index of the first row to set. Leave undefined to add as new rows.

      • Optionalinsert: boolean

        Whether to insert the row at the given index, or to overwrite the row.

      • OptionaleventDetail: DataEventDetail

        Custom information for pending events.

      Returns void

      #setRows

      #afterSetRows