View Configurations

In this guide, you'll learn about view configurations in the Settings Module.

Experimental: This feature is a work in progress, so it may change in future releases.

What is a View Configuration?#

A view configuration is a saved data-table view for an entity, such as products or orders. It lets admin users customize how a table shows its data, then save that customization as a reusable view.

The ViewConfiguration data model stores a view's customizations in its configuration property, which includes:

  • visible_columns: The columns shown in the table.
  • column_order: The order of the columns.
  • column_widths: The width of each column.
  • filters: The applied filters.
  • sorting: The column and direction to sort by.
  • search: The search query.

View Configuration Types#

There are three types of views for an entity:

  1. Code default: The default view built into the dashboard. It has no stored view configuration.
  2. System default: A stored view configuration that has its is_system_default property enabled and no user_id. It applies to all users that don't have a personal view. Only one system default can exist per entity.
  3. Personal view: A stored view configuration that has a user_id. It's private to the user that created it.

Active View#

Each user has an active view for an entity, which is the view they're currently using. The Settings Module resolves a user's active view in the following order:

  1. The view set as active in the user's preferences.
  2. The user's first personal view, if any.
  3. The system default, if any.

The getActiveViewConfiguration method of the module's service resolves the active view, and the setActiveViewConfiguration method sets it.


Manage View Configurations#

The Settings Module's service provides methods to create, retrieve, update, and delete view configurations programmatically. Resolve the service from the Medusa container using Modules.SETTINGS.

Configure View Configurations#

You can customize how columns are generated for an entity, add computed columns, and change how a column's value renders. You can also show a configurable data table in your admin customizations.

Learn how in the Configure View Configurations guide.

Found a problem with this page?Report Issue
Edited Nov 14·Edit this page