customers collection with a field firstname and field lastname. We create a smart field fullname that is a concatenation of the two fields.
Smart field definition
In order to make the field sortable, you need to add theisSortable attribute.
forest/customers.js
Route definition
At the level of the route, you need to catch the query and redirect the sort field from one that does not exist in the database (fullname) to the relevant one (firstname)
routes/customers.js