Where a grid keeps people's views: the last view of each person, which the grid restores when they come back, and named views ("My open orders") that a person saves for themselves or shares with everyone.
<.data_grid id="orders" source={Order} repo={Repo} views={MyApp.GridViews} user={@user}>views is a module of this behaviour. Masu has two:
Masu.Views.Ecto, a table in your database (use Masu.Views.Ecto, repo: MyApp.Repo, andmix masu.gen.viewsfor its migration);Masu.Views.Memory, in memory, for development and tests.
A store of your own implements the callbacks below. A view is kept as
its params (see Masu.View): a map of strings, what differs from the
grid's own view. grid is the grid's views_key (its id unless given)
and user the grid's user; a person is to_string(user.id).
Summary
Callbacks
Deletes a named view of the person's (not one of someone else's).
The person's last view of the grid, or nil.
The named views the person may apply: their own and the shared ones, by name.
Keeps the person's view of the grid, as it changes.
Saves a named view of the person's: a view of theirs with that name is
replaced. shared shows it to everyone who has the grid.
Types
Callbacks
Deletes a named view of the person's (not one of someone else's).
The person's last view of the grid, or nil.
The named views the person may apply: their own and the shared ones, by name.
Keeps the person's view of the grid, as it changes.
@callback save( grid :: String.t(), user :: map(), name :: String.t(), params :: map(), shared :: boolean() ) :: {:ok, saved()} | {:error, String.t()}
Saves a named view of the person's: a view of theirs with that name is
replaced. shared shows it to everyone who has the grid.