Skip to content
Razor catalogue

On this page

@addTagHelper *, Webority.Ui.Razor

On a list page

Put the Views menu above a list's filters, so a saved view opens the same address again.

Orders with a status filter
All Open Closed
Show code
<app-saved-views key="orders" />
<form method="get" data-wui-auto-submit>
    <app-select label="status" name="status" value="@Model.Status" size="ControlSize.Sm">…</app-select>
</form>

Kept on the server

Use mode="server" when people should find their saved views from any browser, because the product stores the views itself. A manager can also share a view with the team.

Views kept on the server
All Open Closed
Show code
<app-saved-views key="orders" mode="AppSavedViewsMode.Server" action="/Orders?handler=Views" can-share="@mayShare" />

public Task<IActionResult> OnGetViewsAsync(string? key, CancellationToken cancellationToken) => this.SavedViewsAsync(Store, "list", key, null, null, false, false, cancellationToken);
public Task<IActionResult> OnPostViewsAsync(string? intent, string? key, string? name, string? query, bool shared, CancellationToken cancellationToken) => this.SavedViewsAsync(Store, intent, key, name, query, shared, mayShare, cancellationToken);

Implement ISavedViewStore over your own table, and set mayShare from your own check (an admin, for example).

Every option

Every value of every prop, one cell each.

key

key="orders": the name its views are stored under

mode

mode="browser" (default): views kept in this browser
mode="server": views kept on the server through action

action

action: the page handler that answers the menu, with mode="server"

can-share

can-share="false" (default): no share switch in the save form
can-share="true": server mode only, adds a Share with the team switch to the save form

Reference

Try every prop, read the full list, and check keyboard and screen reader behaviour.

browser server
false true
Razor, the same props
<app-saved-views key="sandbox-orders" />

4 props.

Less common 4 props

PropTypeDefaultDescription
keydefault - string - The name the views of a list are stored under (browser mode) or asked for (server mode). Required; an empty key throws.
modedefault browser string browser browser keeps the views in this browser; server keeps them through action.
actiondefault - string - The page handler that answers the Views requests. Required with mode=server, refused otherwise.
can-sharedefault false bool false Server mode only. Shows a Share with the team switch in the save form and sends shared with the save. Pass the page's own answer to may this person share views, and pass the same answer to SavedViewsAsync as canShare: a share from a page that says no is refused. Refused with mode=browser.