Saved views
Status: ✅ Implemented
Intent
Section titled “Intent”Power users return to the same slices of data every day: “my pending invoices”, “arrivals this week”, “high-value bookings”. Rebuilding the filter set every time is a tax; bookmarking URLs is invisible and personal-toolbar-dependent. Saved views make the condition set a first-class, named thing on the listing itself.
Solution
Section titled “Solution”Every crud/listing’s smart search bar has a bookmark button on the right. It opens the views panel:
- Save current view as… — snapshots the whole condition set (keyword chip, filter values, range bounds, multi-selects) and the listing’s layout — its sort, its columns (order and hidden ones) and its page size — under a name. Saving an existing name replaces it.
- Click a view — clears the current conditions, applies the view’s and re-runs the search.
- ★ — marks the view as the listing’s default: the listing opens with it applied whenever the URL carries no explicit filter params (an explicitly shared/bookmarked URL always wins). Starring again clears the default.
- ✎ — renames the view; its conditions, layout and ★ stay.
- ✕ — deletes the view.
No annotations needed — it works on every listing that shows the smart search bar, in every renderer.
Where they are kept
Section titled “Where they are kept”On the server, for a signed-in user (the default since 3.0, @Experimental). The views follow the
person: another browser, another computer, the phone app and the desktop app all show the same ones.
They are kept per user and per listing (its route), and nobody else can read or change them — the
owner is always the signed-in caller, never something the browser sends.
In the browser, when the user is anonymous or the app chooses so
(mateu.saved-views.storage=browser): localStorage, key mateu-saved-views, per listing route and
per origin. The React Native app keeps them on the device, per UI and per listing; the desktop app in
the IDE’s settings.
Kept on the server, the renderers hold them only in memory — never in localStorage — so on a shared computer the next person does not see them.
A view that no longer fits
Section titled “A view that no longer fits”A filter can be renamed or removed after a view was saved. Applying that view keeps the conditions the listing still has and tells the user which ones were dropped (“Some conditions of “Big orders” no longer apply: region”), in the user’s language, instead of silently showing other rows.
What a view keeps of the layout
Section titled “What a view keeps of the layout”The layout travels inside the same values, under reserved keys, and only when it is not the
listing’s default — so a view saved before 3.0.18 is still the “active” one when nothing was
reordered:
| Key | Value |
|---|---|
_sort | ["total:descending", "date:ascending"] |
_columnOrder | ["total", "customer"] |
_hiddenColumns | ["notes"] |
_pageSize | 50 |
Applying a view replaces the current layout (a view without one brings the listing’s defaults back). A sort or a column of a field the listing no longer has is dropped and named, like a filter. What each renderer applies: Vaadin (Lumo and Aura), Primer, UI5, SLDS and the phone app — all four; Redwood — sort and columns (its page size is the listing’s own); the desktop app — sort and page size (it has no column chooser).
The server checks everything
Section titled “The server checks everything”The client never decides what is valid. The server refuses: an anonymous caller (403), a missing or too long name (100 characters), a view with no conditions, more than 100 conditions, values that are not plain text, numbers, booleans or lists of them, more than 50 views per listing — with a message the renderer shows as it came.
Choosing the store
Section titled “Choosing the store”The default store keeps the views in memory: fine for a single instance and for trying it out, but they are lost when the app restarts (Mateu warns once at startup). For real use, give Mateu a store.
Any bean implementing io.mateu.uidl.interfaces.SavedViewStore (list, save, delete,
setPreferred; renaming needs nothing more — Mateu does it with those). Mateu ships one over JDBC in
its own optional module — add it only if you want it; nothing in Mateu brings a database driver:
<dependency> <groupId>io.mateu</groupId> <artifactId>mateu-saved-views-jdbc</artifactId></dependency>@BeanSavedViewStore savedViews(DataSource dataSource) { var store = new JdbcSavedViewStore(dataSource); // table mateu_saved_views store.createTableIfMissing(); // or create it with your migrations return store;}store.ddl(product) gives the CREATE TABLE for PostgreSQL, MySQL/MariaDB, SQL Server,
Oracle and H2 if you prefer to put it in Flyway/Liquibase. Only mateu-uidl and the JDK’s java.sql
are needed; the driver is yours.
builder.Services.AddSingleton<ISavedViewStore, MySavedViewStore>();ISavedViewStore (Mateu.Uidl): List, Save, Delete, SetPreferred. Mateu.NET ships no database
store — implement it over whatever you already use.
add_mateu(app, views, saved_view_store=MySavedViewStore())mateu_ui.uidl.SavedViewStore: list, save, delete, set_preferred. No database package is
needed or pulled in.
Settings
Section titled “Settings”| Setting | What it does |
|---|---|
mateu.saved-views.storage = server (default) | browser — .NET MateuOptions.SavedViewsStorage / MATEU_SAVED_VIEWS_STORAGE, Python add_mateu(saved_views="browser") | Where the views are kept. browser keeps the pre-3.0 behaviour. |
On the wire
Section titled “On the wire”Additive:
AppDto.savedViewsOnServer— true when the views of this caller are kept on the server;- app-level actions
_saved-views-list|save|rename|delete|defaultwith{scope, name, values, isDefault}(renametakes{scope, name, newName}), each answeringdata._savedViews = [{name, values, isDefault}].
A renderer that does not know the flag keeps the views in the browser, as before.
Try it
Section titled “Try it”demo/demo-bank (port 8650): Movements filters by kind, date and amount. Save a view, star it,
open the listing in another browser — it opens with the view. The demo keeps the views in H2 through
mateu-saved-views-jdbc (SavedViewsConfig), so they survive a restart.
Related
Section titled “Related”- Filters & Listing — the smart search bar being snapshotted
- Bulk actions — act on the rows the view surfaces
See it live in the Explorer: Saved views & column chooser