Data Set Technical Reference
Summary
DataSet Selected Event
The DataSet Selector provides a way to supply an entirely new Data Set to AdapTable based on user selection.
Caution
This Event is only fired if the DataSet definition does not contain a Form
Hint
If the DataSet contains a Form, any wiring should be done in the onClick of the form's submit Button
DataSetSelectedInfo
The DatasetSelectedInfo object returned by the Event contains the DataSet that has beeen selected:
| Property | Type | Description |
|---|---|---|
| dataSet | DataSet | The DataSet that has been selected |
| 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:
api.eventApi.on('DataSetSelected', (eventInfo: DataSetSelectedInfo) => {
// do something with the info
});Data Set Options
| Property | Type | Description | Default |
|---|---|---|---|
| dataSets | DataSet<TData>[] | Collection of Data Sets to provide data to AdapTable | [] |
Data Set Object
A Data Set is defined as follows:
| Property | Type | Description | Default |
|---|---|---|---|
| description | string | Describes the Data Set | |
| form | AdaptableForm<DataSetFormContext> | Params for Data Set popup form | |
| info | Record<string, string | number | boolean | Date> | Additional info for Data Set | |
| loadData | (info:DataSetSelectedInfo) => TData[] | Promise<TData[]> | Optional shortcut that loads row data into the Grid when this Data Set is selected (only when no form is defined). Runs before onSelect. | undefined |
| name | string | Name of Data Set | |
| onFormSubmit | (context:DataSetFormContext) => void | Promise<void> | Invoked when the user submits the Data Set form (Enter key or form button). When no form buttons are defined, an OK button is added automatically. | undefined |
| onSelect | (info:DataSetSelectedInfo) => void | Promise<void> | Invoked when this Data Set is selected and it does not define a form. | undefined |
| IsReadOnly | boolean | Sets Entity to ReadOnly (overwriting a Strategy Entitlement of 'Full') |
Adaptable Form
The form in the Data Set is defined as follows:
| Property | Type | Description | Default |
|---|---|---|---|
| buttons | AdaptableButton<T>[] | Buttons to include in the Form | |
| description | string | Additional information to appear in the Form | |
| fields | (AdaptableFormField|AdaptableFormField[] |AdaptableFormFieldGroup)[] | Collection of Dynamic Fields and Field Groups to display. | |
| layout | AdaptableFormLayout | How the form's fields are arranged on screen. | 'rows' |
| onSubmit | (formData: TData, context: T) => void | Optional form-level submit hook. | |
| title | string | Title to appear in the Form |
Data Set API
| Method | Returns | Description |
|---|---|---|
| clearCurrentDataSet() | void | Clears currently selected Data Set |
| getCurrentDataSet() | DataSet | undefined | Retrieves the currently applied Data Set |
| getDataSetByName(dataSetName) | DataSet | Retrieves Data Set from State with given name |
| getDataSets() | DataSet[] | Retrieves the Data Sets from Data Set Options |
| openDataSetSettingsPanel() | void | Opens Settings Panel with Data Set section selected and visible |
| setDataSet(dataSetName) | void | Loads the given Data Set (makes it the Current one) |