A dataset serves as an intermediary between page elements, such as input elements and buttons, and the data in a collection. The dataset controls which collection is available to be used by page elements, what those elements can do with the collection data (display, add, modify), which item is currently active and whether the data is filtered or sorted.
A dataset can be in one of three modes, which are set in Dataset Settings panel in the Editor. The dataset's mode cannot be changed programmatically.
- Read & Write: Display and modify data.
- Read-only: Display data.
- Write-only: Add new data.
Another way to work with collection data and page elements is to use the Data API. The Data API lets you work directly with your collections. However, you'll need to write code to read from and write to your page elements. Using the Dataset API allows you to take advantage of the data binding that can be set up in the Editor's connect panels.
The wix-dataset API can only be used in your site’s front-end code.
You do not need to import
Datasets retrieve information from your collections in chunks of items. Each of these chunks is called a page.
A dataset's page size determines how many items are initially displayed in repeaters that are connected to it. Elements that have their own settings for how many items are shown at once, such as tables and galleries, are not affected by the dataset's page size.
Elements that display data from the dataset's current item, such as images and text elements, are affected when you change the current dataset page because the dataset's current item also changes.
You set the page size of a dataset:
- In the Editor using the Number of items to display setting in the Dataset Settings panel.
- In code using the