A person's view of a grid: its query (Masu.Query: order, filters and
search) and its layout (Masu.Layout: the order, visibility, pins and
widths of its columns).
A view goes into the URL and into a store (Masu.Views) as params: a
map of strings, with only what differs from the grid's own view (the
one of its attributes), so that a link stays short and a saved view
takes the grid's later defaults for what it does not change.
%{
"sort" => "-revenue,name",
"q" => "acme",
"group" => "plan",
"filter" => %{"0" => %{"key" => "plan", "op" => "in", "value" => ["team"]}},
"cols" => "id,name,plan,city,revenue",
"hide" => "seats",
"pin" => "id:start,revenue:end",
"w" => "name:220",
"page" => "3"
}"page" is the page of a grid with paging={:pages}, from 1.
Each part that is given replaces the grid's: "sort" => "" is no order,
"hide" => "" hides no column, "filter" => "" has no filter.
Summary
Functions
The view of params, over the grid's own view (default), checked
against the grid's columns (all of them, hidden ones too).
The params of a view: what differs from the grid's own view
(default).
Types
@type t() :: %Masu.View{ layout: Masu.Layout.t(), page: non_neg_integer(), query: Masu.Query.t() }
Functions
@spec from_params(map(), [Masu.Column.t()], t()) :: {t(), [String.t()]}
The view of params, over the grid's own view (default), checked
against the grid's columns (all of them, hidden ones too).
A part that no longer applies (a column that was removed or no longer sorts or filters, a filter value that no longer reads) is left out, and its column's key is in the list it gives, so that the grid can say so: a link or a saved view never fails a grid.
The params of a view: what differs from the grid's own view
(default).