Showing a list of tasks

Use case 2 of a 9 part use case series. In this article, you'll learn how to show a list of tasks.

Before we start

Before we start, we will need some data. We’ve prepared the following tasks to show you how this works:

List of tasks

In our use case to Show a single task, we used a data container component to fetch 1 record from the database.

In this example, we will show you how to get a list of records from the database.

Use a data table component to fetch one or multiple records

In this example, we will use the data table component. We also offer a data list component that kind of acts like the data container with the difference that it will repeat all components you drag into it, for every record that matches your model and filter.

When you drag a data table component on the page, a modal will appear in which you can select the model that you want to represent and the properties you want to see in the table columns.

Step 1: Select model:

Configuring data table

Step 2: Select the properties from the chosen model:

Adding models to a data table

Step 3: Press Save and your table will be created:

Choosing properties for a data table model

Notice for selecting a property from the web user, we have to press the arrow right next to it and select a property in the next view. This is because for this example there is a belongs to relation between tasks and web users. This means a task can be assigned to only one web user. The other way around, a web user can have multiple tasks which are assigned to him/her.

Your data table will look like this:

Data table with tasks

When you select the data table, you can see its options. In there, you will see the selected model. Where we saw Update filter in our data container component from the case Show a single task we now see the following:

Data table options

A model is selected, but there is no filter yet. Which is OK. We will now see all records of this tasks model. With default pagination for 5 records per page. You can change that into anything you like.

When we press play, we will see the following:

List of tasks in the front end

We can see here that the date in the Planned column is not user-friendly. You can change the formatting of this date to your liking.

By going back to the page and selecting the data table column for Planned.

Data table column

The options are shown and we just press the purple button (not the x) and we can see our property selector. We can navigate to the Planned property and re-select it. This time we get an extra modal in which we can define what our output for the date should look like:

Selecting format date property

Let’s select the second one from the top (11/15/2021), English notation. When we have selected this property and its format, we press play again.

Your table will now look like this:

Table with tasks in the front end

There was no filter involved here, so we will just see all records available in our Tasks data model.

In the use cases next up we will cover some of the most-used filter settings based on this table.

 

➝ Next article: Showing a list of tasks belonging to a user