# Class: DataTableCore

## DataTableCore

#### 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.deleteRows` method.

  ##### Parameters:

  Name | Type | Argument | Default | Description
  --- | --- | --- | --- | ---
  `rowIndex` | number |  |  | The start row index
  `rowCount` | number | <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.getRow` method, always returning by reference.

  ##### Parameters:

  Name | Type | Description
  --- | --- | ---
  `columnId` | string | Name of the column to get.

  ##### Returns:

  Highcharts.DataTableColumn | undefined .

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

#### getColumns( [columnIds])

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

  ##### Parameters:

  Name | Type | Argument | Description
  --- | --- | --- | ---
  `columnIds` | Array.<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
  --- | --- | --- | ---
  `rowIndex` | number |  | Row index to retrieve. First row has index 0.
  `columnIds` | Array.<string> | <optional> | Column names to retrieve.

  ##### Returns:

  Record.<string, (number|string|undefined)> | undefined .

  Returns the row values, or `undefined` if 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
  --- | --- | --- | --- | ---
  `columnId` | string |  |  | Column name to set.
  `column` | Highcharts.DataTableColumn | <optional> |  | Values to set in the column.
  `rowIndex` | number | <optional> | 0 | Index of the first row to change. (Default: 0)
  `eventDetail` | Record.<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 (undefined `rowIndex`).

  ##### Parameters:

  Name | Type | Argument | Description
  --- | --- | --- | ---
  `columns` | Highcharts.DataTableColumnCollection |  | Columns as a collection, where the keys are the column names.
  `rowIndex` | number | <optional> | Index of the first row to change. Ignored in the `DataTableCore`, as it always replaces the full column.
  `eventDetail` | Record.<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
  --- | --- | --- | ---
  `row` | Record.<string, (number|string|undefined)> |  | Cell values to set.
  `rowIndex` | number | <optional> | Index of the row to set. Leave `undefined` to add as a new row.
  `insert` | boolean | <optional> | Whether to insert the row at the given index, or to overwrite the row.
  `eventDetail` | Record.<string, (boolean|number|string|null|undefined)> | <optional> | Custom information for pending events.

  ##### Fires:

  - event:#afterSetRows