# Data Set Technical Reference

Canonical page: https://www.adaptabletools.com/docs/technical-reference-data-set

## Data Set Options

| Property | Type | Description | Default |
| --- | --- | --- | --- |
| [dataSets](https://www.adaptabletools.com/docs/reference/datasetoptions.md#datasets) | [`DataSet`](https://www.adaptabletools.com/docs/reference/dataset.md)`<TData>[]` | Collection of Data Sets to provide data to AdapTable | [] |

### Data Set Object

| Property | Type | Description | Default |
| --- | --- | --- | --- |
| [description](https://www.adaptabletools.com/docs/reference/dataset.md#description) | `string` | Describes the Data Set |   |
| [form](https://www.adaptabletools.com/docs/reference/dataset.md#form) | [`AdaptableForm`](https://www.adaptabletools.com/docs/reference/adaptableform.md)`<`[`DataSetFormContext`](https://www.adaptabletools.com/docs/reference/datasetformcontext.md)`>` | Params for Data Set popup form |   |
| [info](https://www.adaptabletools.com/docs/reference/dataset.md#info) | `Record<string, string \| number \| boolean \| Date>` | Additional info for Data Set |   |
| [loadData](https://www.adaptabletools.com/docs/reference/dataset.md#loaddata) | `(info: `[`DataSetSelectedInfo`](https://www.adaptabletools.com/docs/reference/datasetselectedinfo.md)`) => TData[] \| Promise<TData[]>` | Optional shortcut that loads row data into the Grid when this Data Set is<br/>selected (only when no `form` is defined). Runs before `onSelect`. | undefined |
| [name](https://www.adaptabletools.com/docs/reference/dataset.md#name) | `string` | Name of Data Set |   |
| [onFormSubmit](https://www.adaptabletools.com/docs/reference/dataset.md#onformsubmit) | `(context: `[`DataSetFormContext`](https://www.adaptabletools.com/docs/reference/datasetformcontext.md)`) => void \| Promise<void>` | Invoked when the user submits the Data Set form (Enter key or form button).<br/>When no form `buttons` are defined, an OK button is added automatically. | undefined |
| [onSelect](https://www.adaptabletools.com/docs/reference/dataset.md#onselect) | `(info: `[`DataSetSelectedInfo`](https://www.adaptabletools.com/docs/reference/datasetselectedinfo.md)`) => void \| Promise<void>` | Invoked when this Data Set is selected and it does not define a `form`.<br/><br/>Use for custom loading logic (e.g. server requests). The `DataSetSelected`<br/>event is still fired for backward compatibility. | undefined |
| [IsReadOnly](https://www.adaptabletools.com/docs/reference/dataset.md#isreadonly) | `boolean` | Sets Entity to ReadOnly (overwriting a Strategy Entitlement of &#39;Full&#39;) |   |

### Adaptable Form

The form in the Data Set is defined as follows:

Defines the form. `fields` is a list of fields, rows of fields, or field groups. `buttons` are the form buttons. `layout` is `rows` (the default) or `inline`.

| Property | Type | Description | Default |
| --- | --- | --- | --- |
| [buttons](https://www.adaptabletools.com/docs/reference/adaptableform.md#buttons) | [`AdaptableButton`](https://www.adaptabletools.com/docs/reference/adaptablebutton.md)`<T>[]` | Buttons to include in the Form |   |
| [description](https://www.adaptabletools.com/docs/reference/adaptableform.md#description) | `string` | Additional information to appear in the Form |   |
| [fields](https://www.adaptabletools.com/docs/reference/adaptableform.md#fields) | `(`[`AdaptableFormField`](https://www.adaptabletools.com/docs/reference/adaptableformfield.md)` \| `[`AdaptableFormField`](https://www.adaptabletools.com/docs/reference/adaptableformfield.md)`[] \| `[`AdaptableFormFieldGroup`](https://www.adaptabletools.com/docs/reference/adaptableformfieldgroup.md)`)[]` | Collection of Dynamic Fields and Field Groups to display.<br/><br/>Items can be:<br/>- a single  (rendered on its own row in the<br/> default `rows` layout, or as one cell in the `inline` layout),<br/>- an array of  (rendered side-by-side on the<br/> same row in the `rows` layout), or<br/>- an  (a labelled section that<br/> visually groups related fields). |   |
| [layout](https://www.adaptabletools.com/docs/reference/adaptableform.md#layout) | [`AdaptableFormLayout`](https://www.adaptabletools.com/docs/reference/adaptableformlayout.md) | How the form&#39;s fields are arranged on screen.<br/><br/>- `rows` (default): each field on its own row, label on the left and<br/> input on the right. Suitable for popups / wizards.<br/>- `inline`: fields are placed side-by-side on a single horizontal line,<br/> with the label rendered immediately before its input. Designed for<br/> compact contexts such as Dashboard Custom Toolbars where vertical<br/> real-estate is scarce. | &#39;rows&#39; |
| [onSubmit](https://www.adaptabletools.com/docs/reference/adaptableform.md#onsubmit) | `(formData: TData, context: T) => void` | Optional form-level submit hook.<br/><br/>Fired when the user presses `Enter` while focus is inside any field<br/>input AND the form is currently valid. The full `formData` is passed<br/>through, typed as `TData` if you&#39;ve supplied a custom shape.<br/><br/>Use this as an ergonomic shortcut to avoid wiring an explicit &quot;Submit&quot;<br/>button - or in addition to one, so power users can press Enter to<br/>commit. If the form is invalid the hook is not invoked. |   |
| [title](https://www.adaptabletools.com/docs/reference/adaptableform.md#title) | `string` | Title to appear in the Form |   |

Each field is an <ApiLink name="AdaptableFormField" link="adaptableformfield"/>:

| Property | Type | Description | Default |
| --- | --- | --- | --- |
| [clearToDefault](https://www.adaptabletools.com/docs/reference/adaptableformfield.md#cleartodefault) | `boolean` | For single `select` fields only. When the user clears the combobox,<br/>whether to restore  instead of leaving the field empty.<br/><br/>Defaults to `true` when `defaultValue` is set, otherwise `false`.<br/>Set to `false` when an empty selection is a distinct state from the default. |   |
| [defaultValue](https://www.adaptabletools.com/docs/reference/adaptableformfield.md#defaultvalue) | `string \| boolean \| number \| Array<string \| number \| boolean>` | Field Default Value - can be of type string, boolean, number, or for<br/>`select` fields with `multi: true` an array of those.<br/><br/>For single `select` fields, this is also the value restored when the user<br/>clears the combobox (unless  is `false`). |   |
| [disabled](https://www.adaptabletools.com/docs/reference/adaptableformfield.md#disabled) | `boolean \| ((formData: `[`AdaptableFormData`](https://www.adaptabletools.com/docs/reference/adaptableformdata.md)`, context: `[`BaseContext`](https://www.adaptabletools.com/docs/reference/basecontext.md)`) => boolean)` | Disable the field&#39;s input. Either a boolean or a function evaluated<br/>against the current form data. Disabled fields render but the user<br/>cannot edit them. |   |
| [fieldType](https://www.adaptabletools.com/docs/reference/adaptableformfield.md#fieldtype) | [`AdaptableFormFieldType`](https://www.adaptabletools.com/docs/reference/adaptableformfieldtype.md) | Field Type - dictates which UI control is rendered |   |
| [helpText](https://www.adaptabletools.com/docs/reference/adaptableformfield.md#helptext) | `string` | Inline help text rendered immediately below the field&#39;s input. Useful<br/>for short explanations such as &quot;format: YYYY-MM-DD&quot; or &quot;min 3 chars&quot;. |   |
| [hidden](https://www.adaptabletools.com/docs/reference/adaptableformfield.md#hidden) | `boolean \| ((formData: `[`AdaptableFormData`](https://www.adaptabletools.com/docs/reference/adaptableformdata.md)`, context: `[`BaseContext`](https://www.adaptabletools.com/docs/reference/basecontext.md)`) => boolean)` | Hide the field. Either a boolean or a function evaluated against the<br/>current form data. Hidden fields are not rendered and are excluded from<br/>validation. |   |
| [label](https://www.adaptabletools.com/docs/reference/adaptableformfield.md#label) | `string` | Label to display in the Field |   |
| [max](https://www.adaptabletools.com/docs/reference/adaptableformfield.md#max) | `number \| string` | Maximum allowed value. For `number` and `slider`: the highest accepted<br/>number. For `date`, `time` and `datetime`: the latest allowed value in<br/>ISO format. |   |
| [maxLength](https://www.adaptabletools.com/docs/reference/adaptableformfield.md#maxlength) | `number` | Maximum length for `text` and `textarea` fields. |   |
| [min](https://www.adaptabletools.com/docs/reference/adaptableformfield.md#min) | `number \| string` | Minimum allowed value. For `number` and `slider`: the lowest accepted<br/>number. For `date`, `time` and `datetime`: the earliest allowed value<br/>in ISO format (`YYYY-MM-DD` / `HH:mm` / `YYYY-MM-DDTHH:mm`). |   |
| [minLength](https://www.adaptabletools.com/docs/reference/adaptableformfield.md#minlength) | `number` | Minimum length for `text` and `textarea` fields. |   |
| [multi](https://www.adaptabletools.com/docs/reference/adaptableformfield.md#multi) | `boolean` | For `select` fields only. When `true` the field renders as a<br/>multi-select combobox; the field&#39;s value is an array of selected<br/>`option.value`s rather than a single value. | false |
| [name](https://www.adaptabletools.com/docs/reference/adaptableformfield.md#name) | `string` | Name of the Field |   |
| [onValueChange](https://www.adaptabletools.com/docs/reference/adaptableformfield.md#onvaluechange) | `(value: any, context: `[`BaseContext`](https://www.adaptabletools.com/docs/reference/basecontext.md)`) => void` | Optional callback invoked whenever value of this field changes |   |
| [options](https://www.adaptabletools.com/docs/reference/adaptableformfield.md#options) | [`AdaptableFormFieldOption`](https://www.adaptabletools.com/docs/reference/adaptableformfieldoption.md)`[] \| ((formData: `[`AdaptableFormData`](https://www.adaptabletools.com/docs/reference/adaptableformdata.md)`, context: `[`BaseContext`](https://www.adaptabletools.com/docs/reference/basecontext.md)`) => `[`AdaptableFormFieldOption`](https://www.adaptabletools.com/docs/reference/adaptableformfieldoption.md)`[] \| Promise<`[`AdaptableFormFieldOption`](https://www.adaptabletools.com/docs/reference/adaptableformfieldoption.md)`[]>)` | Items to populate the `select` and `radio` fieldTypes.<br/><br/>Either a static array, or a function that derives the options from the<br/>current form data and Adaptable context. The function form may return<br/>a Promise for asynchronously-loaded options - the form will render the<br/>field with no items until the promise resolves. |   |
| [pattern](https://www.adaptabletools.com/docs/reference/adaptableformfield.md#pattern) | `string` | Regular expression that the value of a `text` field must match. |   |
| [placeholder](https://www.adaptabletools.com/docs/reference/adaptableformfield.md#placeholder) | `string` | Placeholder text shown inside `text`, `textarea`, `number`, `date`,<br/>`time` and `datetime` inputs when empty. For `select` fields it is<br/>rendered as the empty-state label when no value is selected.<br/><br/>When omitted on a `select` field with a , the label of<br/>the matching `options` entry is used as the empty-state label. |   |
| [render](https://www.adaptabletools.com/docs/reference/adaptableformfield.md#render) | `(params: `[`AdaptableFormFieldRenderParams`](https://www.adaptabletools.com/docs/reference/adaptableformfieldrenderparams.md)`) => React.ReactNode` | For `custom` fields only. Renders an arbitrary React node as the<br/>field&#39;s input. Receives the current value, a `setValue` setter<br/>(controlled), the current form data, the Adaptable context and the<br/>resolved `disabled` state.<br/><br/>Use this as an escape hatch when none of the built-in `fieldType`s<br/>fit - e.g. to render a star-rating widget, a tag editor or any<br/>bespoke control. |   |
| [required](https://www.adaptabletools.com/docs/reference/adaptableformfield.md#required) | `boolean` | If `true` the field is treated as required. An empty value (`''`,<br/>`null`, `undefined`, or unchecked checkbox) will produce a validation<br/>error. |   |
| [rows](https://www.adaptabletools.com/docs/reference/adaptableformfield.md#rows) | `number` | For `textarea` fields: the visible number of text rows. | 3 |
| [step](https://www.adaptabletools.com/docs/reference/adaptableformfield.md#step) | `number` | Stepping interval for `number`, `slider`, `time` and `datetime`<br/>fields. |   |
| [tooltip](https://www.adaptabletools.com/docs/reference/adaptableformfield.md#tooltip) | `string` | Tooltip shown when hovering the field&#39;s label. |   |
| [validate](https://www.adaptabletools.com/docs/reference/adaptableformfield.md#validate) | `(value: any, formData: `[`AdaptableFormData`](https://www.adaptabletools.com/docs/reference/adaptableformdata.md)`, context: `[`BaseContext`](https://www.adaptabletools.com/docs/reference/basecontext.md)`) => string \| null \| undefined` | Custom field-level validation. Return an error message string to mark<br/>the field invalid, or `null`/`undefined` if the value is valid.<br/><br/>Custom validation runs *after* built-in checks (`required`, `min`,<br/>`max`, `pattern`, etc.) - the first failing check wins. |   |

`fieldType` is an <ApiLink name="AdaptableFormFieldType" link="adaptableformfieldtype"/>:

[See API: adaptableformfieldtype](https://www.adaptabletools.com/docs/reference/adaptableformfieldtype.md)

Select and radio `options` are <ApiLink name="AdaptableFormFieldOption" link="adaptableformfieldoption"/> objects:

| Property | Type | Description |
| --- | --- | --- |
| [label](https://www.adaptabletools.com/docs/reference/adaptableformfieldoption.md#label) | `string` | Text shown for this choice. |
| [value](https://www.adaptabletools.com/docs/reference/adaptableformfieldoption.md#value) | `any` | Value written into the form data when this choice is selected. |

`layout` is an <ApiLink name="AdaptableFormLayout" link="adaptableformlayout"/>:

[See API: adaptableformlayout](https://www.adaptabletools.com/docs/reference/adaptableformlayout.md)

`buttons` are <ApiLink name="AdaptableButton" link="adaptablebutton"/> objects:

| Property | Type | Description | Default |
| --- | --- | --- | --- |
| [buttonStyle](https://www.adaptabletools.com/docs/reference/adaptablebutton.md#buttonstyle) | [`ButtonStyle`](https://www.adaptabletools.com/docs/reference/buttonstyle.md)` \| ((button: `[`AdaptableButton`](https://www.adaptabletools.com/docs/reference/adaptablebutton.md)`<CONTEXT_TYPE>, context: CONTEXT_TYPE) => `[`ButtonStyle`](https://www.adaptabletools.com/docs/reference/buttonstyle.md)`)` | Style for Button - can be object or function that provides a `ButtonStyle` object |   |
| [disabled](https://www.adaptabletools.com/docs/reference/adaptablebutton.md#disabled) | `(button: `[`AdaptableButton`](https://www.adaptabletools.com/docs/reference/adaptablebutton.md)`<CONTEXT_TYPE>, context: CONTEXT_TYPE) => boolean` | Function that disables / enables the button based on its evaluation result |   |
| [hidden](https://www.adaptabletools.com/docs/reference/adaptablebutton.md#hidden) | `(button: `[`AdaptableButton`](https://www.adaptabletools.com/docs/reference/adaptablebutton.md)`<CONTEXT_TYPE>, context: CONTEXT_TYPE) => boolean` | Function which sets whether Button is hidden |   |
| [icon](https://www.adaptabletools.com/docs/reference/adaptablebutton.md#icon) | [`AdaptableIcon`](https://www.adaptabletools.com/docs/reference/adaptableicon.md)` \| ((button: `[`AdaptableButton`](https://www.adaptabletools.com/docs/reference/adaptablebutton.md)`<CONTEXT_TYPE>, context: CONTEXT_TYPE) => `[`AdaptableIcon`](https://www.adaptabletools.com/docs/reference/adaptableicon.md)`)` | Icon for Button - can be object or function that provides a `AdaptableIcon` object |   |
| [iconPosition](https://www.adaptabletools.com/docs/reference/adaptablebutton.md#iconposition) | `'start' \| 'end'` | Where the icon appears relative to the label | &#39;start&#39; |
| [label](https://www.adaptabletools.com/docs/reference/adaptablebutton.md#label) | `string \| ((button: `[`AdaptableButton`](https://www.adaptabletools.com/docs/reference/adaptablebutton.md)`<CONTEXT_TYPE>, context: CONTEXT_TYPE) => string)` | Label for Button - can be string or function that provides string |   |
| [onClick](https://www.adaptabletools.com/docs/reference/adaptablebutton.md#onclick) | `(button: `[`AdaptableButton`](https://www.adaptabletools.com/docs/reference/adaptablebutton.md)`<CONTEXT_TYPE>, context: CONTEXT_TYPE) => void` | Function to invoke when button is clicked |   |
| [tooltip](https://www.adaptabletools.com/docs/reference/adaptablebutton.md#tooltip) | `string \| ((button: `[`AdaptableButton`](https://www.adaptabletools.com/docs/reference/adaptablebutton.md)`<CONTEXT_TYPE>, context: CONTEXT_TYPE) => string)` | Tooltip for Button - can be string or function that provides string |   |

`buttonStyle` is a <ApiLink name="ButtonStyle" link="buttonstyle"/>:

| Property | Type | Description | Default |
| --- | --- | --- | --- |
| [className](https://www.adaptabletools.com/docs/reference/buttonstyle.md#classname) | `string` | CSS Classname to use for the Button |   |
| [tone](https://www.adaptabletools.com/docs/reference/buttonstyle.md#tone) | `'success' \| 'error' \| 'neutral' \| 'none' \| 'warning' \| 'info' \| 'accent'` | Button&#39;s Tone - values: &#39;success&#39;, &#39;error&#39;, &#39;neutral&#39;, &#39;none&#39;, &#39;warning&#39;, &#39;info&#39;, &#39;accent&#39; | &#39;neutral&#39; |
| [variant](https://www.adaptabletools.com/docs/reference/buttonstyle.md#variant) | `'text' \| 'outlined' \| 'raised'` | How Button appears - values: &#39;text&#39;, &#39;outlined&#39;, &#39;raised&#39; | &#39;outlined&#39; |

`form` and `onFormSubmit` receive a [`DataSetFormContext`](https://www.adaptabletools.com/docs/reference/datasetformcontext.md):

| Property | Type | Description |
| --- | --- | --- |
| [dataSet](https://www.adaptabletools.com/docs/reference/datasetformcontext.md#dataset) | [`DataSet`](https://www.adaptabletools.com/docs/reference/dataset.md) | The DataSet which triggered the Form |
| [adaptableContext](https://www.adaptabletools.com/docs/reference/datasetformcontext.md#adaptablecontext) | `any` | Custom application Context provided in `AdaptableOptions.adaptableContext` |

---

## Data Set API

| Method | Returns | Description |
| --- | --- | --- |
| [clearCurrentDataSet()](https://www.adaptabletools.com/docs/reference/datasetapi.md#clearcurrentdataset) | `void` | Clears currently selected Data Set |
| [getCurrentDataSet()](https://www.adaptabletools.com/docs/reference/datasetapi.md#getcurrentdataset) | [`DataSet`](https://www.adaptabletools.com/docs/reference/dataset.md)` \| undefined` | Retrieves the currently applied Data Set |
| [getDataSetByName(dataSetName)](https://www.adaptabletools.com/docs/reference/datasetapi.md#getdatasetbyname) | [`DataSet`](https://www.adaptabletools.com/docs/reference/dataset.md) | Retrieves Data Set from State with given name |
| [getDataSets()](https://www.adaptabletools.com/docs/reference/datasetapi.md#getdatasets) | [`DataSet`](https://www.adaptabletools.com/docs/reference/dataset.md)`[]` | Retrieves the Data Sets from Data Set Options |
| [openDataSetSettingsPanel()](https://www.adaptabletools.com/docs/reference/datasetapi.md#opendatasetsettingspanel) | `void` | Opens Settings Panel with Data Set section selected and visible |
| [setDataSet(dataSetName)](https://www.adaptabletools.com/docs/reference/datasetapi.md#setdataset) | `void` | Loads the given Data Set (makes it the Current one) |

---

## DataSet Selected Event

The DataSet Selector provides a way to supply an entirely new Data Set to AdapTable based on user selection.

This Event is only fired if the DataSet definition **does not** contain a Form

If the DataSet contains a Form, any wiring should be done in the `onClick` of the form's submit [Button](https://www.adaptabletools.com/docs/ui-tutorial-displaying-adaptable-buttons/index.md)

### DataSetSelectedInfo

The [`DatasetSelectedInfo`](https://www.adaptabletools.com/docs/reference/datasetselectedinfo.md) object returned by the Event contains the DataSet that has been selected:

| Property | Type | Description |
| --- | --- | --- |
| [dataSet](https://www.adaptabletools.com/docs/reference/datasetselectedinfo.md#dataset) | [`DataSet`](https://www.adaptabletools.com/docs/reference/dataset.md) | Data Set that was selected. |
| [adaptableContext](https://www.adaptabletools.com/docs/reference/datasetselectedinfo.md#adaptablecontext) | `any` | Custom application Context provided in `AdaptableOptions.adaptableContext` |

### Event Subscription

Subscribing to the Event is done the same way as with all [Adaptable Events](https://www.adaptabletools.com/docs/technical-reference-adaptable-events/index.md):

```ts
api.eventApi.on('DataSetSelected', (eventInfo: DataSetSelectedInfo) => {
  // do something with the info
});
```

---
