Datasets connect your CMS collections to page elements, allowing you to control how content displays and how visitors interact with it. Unlike the Data API which works directly with collections, datasets handle the connection between data and UI elements automatically.
You use datasets when you want to bind collection data to page elements without writing connection code. The Dataset API extends the built-in dataset functionality with additional control over filtering, sorting, pagination, and data validation.
The Dataset API includes methods to control dataset behavior and interact with collection data. For dynamic pages, use the Dynamic Dataset API which provides similar functionality with additional methods for dynamic page contexts.
These APIs contain the following functionality:
onReady() method to ensure both the page and dataset have finished loading before your dataset-related code executes.onBeforeSave() to implement custom validation when saving data from connected input elements.Dataset modes control the type of interaction between your dataset and collection data. They determine whether site visitors can view data, add new items, edit existing items, or some combination of these actions.
The mode you choose determines which dataset methods are available for you to call through the Dataset API.
The available modes are:
getCurrentItem() and getItems(). Use for showing data without allowing modifications.add() and save(). Use for forms that collect new data.remove() and navigation methods. Use for interactive pages where visitors can view and edit data.