Selecting DataSets
Summary
- The DataSet Selector supplies an entirely new DataSet to AdapTable based on user selection
- DataSets suit scenarios when there is too much data to send to the client at start-up
- Users switch at run time between DataSets provided by developers at design-time
- DataSets can include Form definitions, shown when that DataSet is selected
- AdapTable re-populates AG Grid after each selection
DataSets allow developers to supply large amounts of data to AdapTable, in differing sets as required.
All this is done while still using AG Grid's Client Side Row Model.
Hint
- DataSets are a great alternative to the Server-Side Row Model
- Data can be fetched when the user picks a DataSet, without building full server-side filtering infrastructure
- Users can still filter the returned rows on the client as usual
Developers provide multiple DataSets for users to choose from, based on the same column set.
Caution
- DataSets cannot be used for data with non-overlapping fields
- The same AdapTable instance and column-based objects require a consistent column set
Topics in this Section
DataSet Forms
- Parameterise DataSet with Adaptable Form
- Load data using
onFormSubmit - Understanding
DataSetSelected
DataSets Technical Reference
- DataSet Options and the DataSet object
- DataSet API
- DataSet Selected event
DataSet Selector
AdapTable lists configured DataSets in the DataSet Selector.
Hint
- DataSets typically map to concepts in the user's business model — a stored procedure, a time period, or a familiar category (e.g. 'book')
The DataSet Selector appears in:
DataSet Forms
DataSets can optionally include Form definitions so users can narrow what data is returned.
When a DataSet with a form is selected, AdapTable displays an Adaptable Form.
Find Out More
See DataSet Forms
3 Ways to Load Data
AdapTable does not fetch data by itself when a DataSet Is selected:
Instead you do it one of 3 different ways:
Note
This is for DataSets without a form
- Using
loadDataon the DataSet - Using onSelect for custom or async loading
- Subscribing to DataSetSelected
Developer Guide
Using loadData on the DataSet (recommended for row data)
dataSetOptions: {
dataSets: [
{
name: 'JavaScript',
description: 'JavaScript Frameworks',
loadData: () => rowData.filter(r => r.language === 'JavaScript'),
},
],
},Return row data (or a Promise of rows). AdapTable calls gridApi.loadGridData when the DataSet is selected. Runs before onSelect.
Developer Guide
Using onSelect for custom or async loading
Developer Guide
Subscribing to DataSetSelected
Hint
- Do not use
loadDataandonSelecttogether unless you intend both to run (loadDataruns first) - For DataSets with a
form, AdapTable does not fireDataSetSelected; use DataSet Forms andonFormSubmit
- This example (usually real DataSets are much larger) defines 3 DataSets in
dataSetOptions.dataSets, each with aloadDatafunction that filters demorowDatabyLanguage gridOptions.rowDataisnullso the grid starts empty until the user selects a DataSet — typical when data is loaded on demand rather than at start-up
- Open the DataSet Selector and pick a DataSet to load rows
- Switch between DataSets to replace grid data
Defining DataSets
DataSets are provided in the dataSets property of DataSet Options.
Each DataSet includes a name and description, and optionally form, loadData, onSelect, and onFormSubmit (see the DataSet reference).
dataSets
UI Entitlements
UI Entitlements behaviour is as follows:
Full— DataSets can be selected; all DataSet UI components are availableHidden— no DataSet UI is visible or availableReadOnly— same asFullfor this module: users only select DataSets; there is nothing to create, edit, or persist in DataSet UI, so ReadOnly does not add restrictions beyondHidden
FAQ
Do DataSets support parameterised queries? Yes. Add an Adaptable Form on the DataSet definition. AdapTable shows it when that DataSet is selected. See DataSet Forms.