Creating List Pages
Setup
This guide assumes you have a CmsPlugin with an Article entity, as covered in the Extending the Dashboard: Plugin Setup guide.
List pages can be easily created for any query in the Admin API that follows the PaginatedList pattern.
For example, the articles query of our CmsPlugin looks like this:
List Page Example
First we'll create a new article-list.tsx file in the ./src/plugins/cms/dashboard directory:
Let's register this route (and we can also remove the test page) in our index.tsx file:
After adding new Dashboard files to your plugin, you'll need to re-start the dev server for those files to be picked up by Vite:
The ListPage Component
The ListPage component can be customized to your exact needs, such as:
- Setting the columns which are visible by default
- Setting the default order of the columns
- Defining bulk actions ("delete all selected" etc.)
See the ListPage component reference for an explanation of the available options.
Customizing Columns
It is common that you will want to customize the way certain columns are rendered. This is done
using the customizeColumns prop on the ListPage component.
By default, an appropriate component will be chosen to render the column data based on the data type of the field. However, in many cases you want to have more control over how the column data is rendered.