Data Set Technical Reference

Summary

  • Data Sets are defined in DataSet Options
  • Data Set Selected Event is raised when a Data Set has been selected by the User
  • Data Set API Section of Adaptable API accesses Data Set functionality at runtime

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:

PropertyTypeDescription
dataSetDataSetThe DataSet that has been selected
adaptableContextanyCustom 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

PropertyTypeDescriptionDefault
dataSetsDataSet<TData>[]Collection of Data Sets to provide data to AdapTable[]

Data Set Object

A Data Set is defined as follows:

PropertyTypeDescriptionDefault
descriptionstringDescribes the Data Set
formAdaptableForm<DataSetFormContext>Params for Data Set popup form
infoRecord<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
namestringName 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
IsReadOnlybooleanSets Entity to ReadOnly (overwriting a Strategy Entitlement of 'Full')

Adaptable Form

The form in the Data Set is defined as follows:

PropertyTypeDescriptionDefault
buttonsAdaptableButton<T>[]Buttons to include in the Form
descriptionstringAdditional information to appear in the Form
fields(AdaptableFormField|AdaptableFormField[] |AdaptableFormFieldGroup)[]Collection of Dynamic Fields and Field Groups to display.
layoutAdaptableFormLayoutHow the form's fields are arranged on screen.'rows'
onSubmit(formData: TData, context: T) => voidOptional form-level submit hook.
titlestringTitle to appear in the Form

Data Set API

MethodReturnsDescription
clearCurrentDataSet()voidClears currently selected Data Set
getCurrentDataSet()DataSet | undefinedRetrieves the currently applied Data Set
getDataSetByName(dataSetName)DataSetRetrieves Data Set from State with given name
getDataSets()DataSet[]Retrieves the Data Sets from Data Set Options
openDataSetSettingsPanel()voidOpens Settings Panel with Data Set section selected and visible
setDataSet(dataSetName)voidLoads the given Data Set (makes it the Current one)