Setting up a Dataset

Data is stored in a database, out of view from users visiting a website. Wix uses datasets to connect this data to the parts of your site the user interacts with.

Adding a Collection

A collection is a table inside of a database that stores your site’s data/information. To create a collection, turn on Dev Mode from your site’s top bar, and the Content Manager button will appear. Click on the Content Manager button. Depending on the template you used to create your site, you may already have a preset collection or two created for you. In the image below, we have a “Coupons” collection. Ignore that for now, and click Create New Collection to start with a blank slate.

Wix Create New Collection Button

To get started, create a collection called ‘Desserts’, because everyone has a sweet tooth! You can keep the default ID, and set the permissions to Site Content. Next, click Create Collection, and add fields for a Title, Image, and Main Ingredient. Finally, fill in the desserts you want to store.

Wix Collection

To get the data from your collection to show up on your page, you need a dataset! Datasets are like imaginary wires between your collection and page. Through these wires, you control how visitors interact with the data in your collections.

Adding a Dataset

To add a dataset:

  1. Click on the Content Manager Button.
  2. Click the Add Content Elements tab.
  3. Click Dataset.

You’ll now see a new dataset icon on the page. This icon will not be visible on the published site, so you can move it around wherever you’d like. You can test this out by clicking the Preview button.

Wix Dataset Icon

Setting up a Dataset

The dataset is currently unconfigured because you haven’t connected it to any data yet. Click on the icon, and then click Settings. Here you can:

Connect the Dataset to a Content Collection

Choose which collection you want the dataset to connect to. You’ll connect to the Desserts collection you created earlier.

Give it a Name

This will default to the name of the collection followed by “dataset”, e.g. “Desserts dataset”. The default name is perfect for most cases, but if you have multiple datasets connecting the same collection, you may want to choose a more unique name that describes the particular dataset better.

Set the Mode

  • Read-only: Visitors cannot edit, add to, or delete any content in your collection. Think of it like a book. You want users to be able to read it but you don’t want them to add or edit the book’s pages.

  • Write-only: Data from your collection is not displayed on the page, but visitors can add data to the collection through a web form. Think of it like an election. You can cast your vote, but you can’t edit, or check how others voted.

  • Read & Write: Data from your collection is displayed on the page, where visitors can add to, and/or edit it. Think of it like a shared grocery list. You, and anyone who has access to it, can read it, as well as edit the items on it.

Set Number of Items to Display

This is the number of items that will initially be displayed when the page loads. The default number of 12 is a good place to start. You can always limit, or expand it, based on how many results you’d like to display at a time.

Filter and Sort the data

You can filter and sort the dataset to control which items appear on the page, and in what order. Let’s say you’re craving chocolate and no other dessert will do. You can set a filter to meet your criteria, like setting the filter to only display desserts that contain chocolate. Then using the sort option, you can list the results as you prefer — for example, you can sort the desserts in alphabetical order.

Wrap up

After connecting, naming, and customizing the dataset, the icon is now connected to your Desserts collection. Great job! You’ve taken the first step in utilizing data on your website. Just like prepping ingredients for baking, it’s important to set up your database components prior to using the data. The next step is to connect your dataset to an element!