MentorGridExtensions class
The MentorGridExtensions class of Novior.MentorAgent.Abstractions.Interfaces: A page's grid, a table of rows, as UI actions the model can use: open a row by…
On this page
A page's grid, a table of rows, as UI actions the model can use: open a row by its key, sort by a column, write in the grid's filter. Nothing of the rows goes back to the model: each action answers done, or not done and why.
Definition
Section titled “Definition”Namespace: Novior.MentorAgent.Abstractions.Interfaces. Package: Novior.MentorAgent.Abstractions.
public static class MentorGridExtensions
dotnet add package Novior.MentorAgent.AbstractionsMethods
Section titled “Methods”RegisterGrid
Section titled “RegisterGrid”public static IMentorPageContext RegisterGrid<TRow>(this IMentorPageContext page, string name, string description, IJSRuntime js, Expression<Func<TRow?, object?>> key, Action<MentorGridOptions>? configure = null)
Registers the grid whose rows are TRow as the UI actions open_<name>_row, sort_<name> and filter_<name>.
open_<grid>_row({ key }) finds the row whose key cell reads the key, as the page shows it, after the grid's filter or scrolling the rows (a virtualized grid renders them as they come into view), and clicks what opens it. The key is key, a property of the row: a text, a whole number, a Guid or an enum, and never a sensitive one.
sort_<grid>({ column, descending? }) clicks the column's header until its aria-sort says the order asked, three clicks at most; a header that does not say its order is not sorted. It is offered when the grid sorts by a column: by default every column of a simple type that is not sensitive (MentorGridOptions.Sortable). filter_<grid>(text) writes the text in the grid's filter, and an empty text clears it; it is offered unless MentorGridOptions.Filter is false.
Each part is found by its data-mentor-id: "<grid>.row", "<grid>.cell.<key>", "<grid>.open", "<grid>.filter" and "<grid>.sort.<column>", the column written as the model sees it, unless MentorGridOptions.Selector gives another selector. The steps run in the browser through js, the page's own IJSRuntime, with the recipes' runner, on Blazor Server, WebAssembly and MAUI Hybrid. A part that is not in the page, hidden, disabled or inside data-mentor-exclude fails the action, which the gate reports as failed.
Parameters
page: The page's context.name: The grid's name: letters, digits,_and-.description: What the grid is, for the model and for the decisions ("The orders of the customer").js: The page's JavaScript runtime (@inject IJSRuntime JS).key: The row's key, a property ofTRow:r => r.Id.configure: The columns sorted by, the filter, sensitive columns let in, selectors of the page's own.
