new DataTableCore( [options])
Constructs an instance of the DataTable class.
Parameters:
| Name | Type | Argument | Description |
|---|---|---|---|
options |
Highcharts.DataTableOptions |
<optional> |
Options to initialize the new DataTable instance. |
Example
const dataTable = new Highcharts.DataTableCore({
columns: {
year: [2020, 2021, 2022, 2023],
cost: [11, 13, 12, 14],
revenue: [12, 15, 14, 18]
}
});
Methods
-
deleteRows(rowIndex [, rowCount])
-
Delete rows. Simplified version of the full
DataTable.deleteRowsmethod.Parameters:
Name Type Argument Default Description rowIndexnumber The start row index
rowCountnumber <optional>
1 The number of rows to delete
Fires:
- event:#afterDeleteRows
Returns:
-
getColumn(columnId)
-
Fetches the given column by the canonical column name. Simplified version of the full
DataTable.getRowmethod, always returning by reference.Parameters:
Name Type Description columnIdstring Name of the column to get.
Returns:
-
getColumns( [columnIds])
-
Retrieves all or the given columns. Simplified version of the full
DataTable.getColumnsmethod, always returning by reference.Parameters:
Name Type Argument Description columnIdsArray.<string> <optional>
Column ids to retrieve.
Returns:
Highcharts.DataTableColumnCollection .Collection of columns. If a requested column was not found, it is
undefined. -
getModified()
-
Returns the modified (clone) or the original data table if the modified one does not exist.
Returns:
Highcharts.DataTableCore .The modified (clone) or the original data table.
-
getRow(rowIndex [, columnIds])
-
Retrieves the row at a given index.
Parameters:
Name Type Argument Description rowIndexnumber Row index to retrieve. First row has index 0.
columnIdsArray.<string> <optional>
Column names to retrieve.
Returns:
Record.<string, (number|string|undefined)> | undefined .Returns the row values, or
undefinedif not found. -
setColumn(columnId [, column] [, rowIndex] [, eventDetail])
-
Sets cell values for a column. Will insert a new column, if not found.
Parameters:
Name Type Argument Default Description columnIdstring Column name to set.
columnHighcharts.DataTableColumn <optional>
Values to set in the column.
rowIndexnumber <optional>
0 Index of the first row to change. (Default: 0)
eventDetailRecord.<string, (boolean|number|string|null|undefined)> <optional>
Custom information for pending events.
Fires:
- event:#setColumns
- event:#afterSetColumns
-
setColumns(columns [, rowIndex] [, eventDetail])
-
Sets cell values for multiple columns. Will insert new columns, if not found. Simplified version of the full
DataTableCore.setColumns, limited to full replacement of the columns (undefinedrowIndex).Parameters:
Name Type Argument Description columnsHighcharts.DataTableColumnCollection Columns as a collection, where the keys are the column names.
rowIndexnumber <optional>
Index of the first row to change. Ignored in the
DataTableCore, as it always replaces the full column.eventDetailRecord.<string, (boolean|number|string|null|undefined)> <optional>
Custom information for pending events.
Fires:
- event:#setColumns
- event:#afterSetColumns
-
setRow(row [, rowIndex] [, insert] [, eventDetail])
-
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. A simplified version of the full
DateTable.setRow, limited to objects.Parameters:
Name Type Argument Description rowRecord.<string, (number|string|undefined)> Cell values to set.
rowIndexnumber <optional>
Index of the row to set. Leave
undefinedto add as a new row.insertboolean <optional>
Whether to insert the row at the given index, or to overwrite the row.
eventDetailRecord.<string, (boolean|number|string|null|undefined)> <optional>
Custom information for pending events.
Fires:
- event:#afterSetRows