Skip to main content
Smart Views let you replace the default table view with any UI you can code. Display orders on a map, events in a calendar, pictures in a gallery, all powered by your real data and integrated with Forest actions.
Map Smart View on a collection

A map-based Smart View replacing the default table view

What is a smart view?

A Smart View is a Glimmer Component composed of three files: a JavaScript component, an HTML/Handlebars template, and a CSS stylesheet. Forest hosts and runs this code directly in your back-office.
You don’t need to know Ember.js to write a Smart View. The examples below cover all the patterns you’ll need. For advanced use, refer to the Glimmer Component and Handlebars Template documentation.
Your code must be compatible with Ember 4.12.

Creating a smart view

Forest provides an online editor to write your Smart View code. Access it from the collection’s Settings, then the Smart Views tab.
Smart View code editor

The Smart View code editor, template, component, and style tabs

Available properties

Forest automatically injects the following properties into your Smart View:

Available actions

Forest also injects the following actions:

Working with records

Iterating over records

Access all records from the @records property and iterate in your template:

Accessing field values

Access field values using the forest- prefix before the field name:

Accessing belongsTo relationships

Accessing a belongsTo relationship works the same as a field. Forest automatically fetches the related data via API when needed:

Accessing hasMany relationships

Same behavior applies for hasMany relationships:

Refreshing records

Call @fetchRecords to reload the current page of records:

Fetching records with custom filters

Use the store service to query any collection with custom filters. In the example below, a calendar view fetches appointments within a date range:
component.js
template.hbs

Query parameters

Deleting records

The deleteRecords action deletes one or multiple records. A confirmation dialog is shown automatically.
template.hbs
component.js

Triggering actions

Action triggering inside the Smart View editor may not work correctly, as not all context is available. Test action execution from the Smart View applied to the collection view.
Use triggerSmartAction to invoke an action directly from your Smart View.
template.hbs
component.js
The triggerSmartAction function signature:
To pass values programmatically and skip the action form:
template.hbs
component.js

Applying a smart view

To activate a Smart View on a collection:
  1. Enable the Layout Editor mode (top navigation bar)
  2. Click the view type button (table icon)
  3. Drag and drop your Smart View to the first position in the dropdown
Reordering Smart Views in Layout Editor

Reordering views in Layout Editor mode to apply a Smart View

Layout Editor toggle in the top navigation

Enabling Layout Editor mode from the top navigation bar

The view refreshes automatically. Disable Layout Editor mode when done.
Once a Smart View is applied to a collection, it also appears in related data panels and summary views. It is not currently possible to set different views for the table, summary, and related data contexts independently.
Smart View in a Related Data panel

A Smart View also appears in Related Data panels

Smart View in a Summary View

A Smart View also appears in Summary Views

Examples

Calendar view

Displays collection records on a calendar using FullCalendar. The component loads the library from CDN and uses date-range conditions to fetch relevant records.
Calendar Smart View

Calendar Smart View built with FullCalendar

component.js
style.css
template.hbs

Map view

Displays geo-located records on an interactive map using Leaflet. Clicking a marker opens the corresponding record. New records can be created by placing a marker.
Delivery map Smart View

Delivery map Smart View built with Leaflet

component.js
style.css
template.hbs
Displays records as a grid of images. Each image links to the corresponding record’s detail page.
Gallery Smart View

Gallery Smart View showing records as a grid of images

component.js
style.css
template.hbs

Shipping status view

Displays a master-detail layout: a scrollable list of orders on the left and a progress bar card on the right showing the shipping status of the selected order.
Shipping status Smart View

Shipping status Smart View, master-detail layout with a progress bar

component.js
template.hbs