
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.
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.
Available properties
Forest automatically injects the following properties into your Smart View:| Property | Type | Description |
|---|---|---|
collection | Model | The current collection |
currentPage | Number | The current page |
isLoading | Boolean | Indicates if the UI is currently loading records |
numberOfPages | Number | The total number of available pages |
records | Array | Your data entries |
searchValue | String | The current search value |
Available actions
Forest also injects the following actions:| Action | Description |
|---|---|
deleteRecords(records) | Delete one or multiple records |
triggerSmartAction(collection, actionName, record) | Trigger an action defined on the specified collection on a record |
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 theforest- prefix before the field name:
Accessing belongsTo relationships
Accessing abelongsTo relationship works the same as a field. Forest automatically fetches the related data via API when needed:
Accessing hasMany relationships
Same behavior applies forhasMany relationships:
Refreshing records
Call@fetchRecords to reload the current page of records:
Fetching records with custom filters
Use thestore 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
| Parameter | Type | Description |
|---|---|---|
filters | Object | A stringified JSON object. A single filter uses { field, operator, value }. An aggregation uses { aggregator: "and"/"or", conditions: [...] }. Operators: less_than, greater_than, equal, after, before, contains, starts_with, ends_with, not_contains, present, not_equal, blank |
timezone | String | Timezone string, e.g. America/Los_Angeles |
page[number] | Number | Page number to fetch |
page[size] | Number | Number of records per page |
Deleting records
ThedeleteRecords action deletes one or multiple records. A confirmation dialog is shown automatically.
template.hbs
component.js
Triggering actions
UsetriggerSmartAction to invoke an action directly from your Smart View.
template.hbs
component.js
triggerSmartAction function signature:
| Argument | Description |
|---|---|
context | Reference to the component, use this |
collection | The collection where the action is defined |
actionName | The action name |
records | An array of records or a single record |
callback | Function executed after the action completes, receives the action result as its only parameter |
values | Object containing values to pre-fill the action form fields |
template.hbs
component.js
Applying a smart view
To activate a Smart View on a collection:- Enable the Layout Editor mode (top navigation bar)
- Click the view type button (table icon)
- Drag and drop your Smart View to the first position in the dropdown


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.


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.
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.
component.js
style.css
template.hbs
Gallery view
Displays records as a grid of images. Each image links to the corresponding record’s detail page.
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.
component.js
template.hbs