Selection
Since 0.1.0-alpha.24
The members for selection, and the types they use. Every member of
IzzyBlazor.TreeList<TItem> is on the TreeList API.
Properties (7)
Cascadebool = trueWith SelectionMode.Multiple, checking a row checks the rows under it, and a row with some of them checked shows a mixed box. A checked row stands for its whole branch: rows under it come in checked as they're drawn, and ApplyTree finds them all. On by default; false makes each box its own.
SelectOnClickbool = falseA click on a row selects it, with IzzyBlazor's script; clicks on its links, buttons and fields stay theirs. With one row (SelectionMode.Single) the radio buttons are hidden, and Space on the selected row clears it. With several, a click selects only that row, Ctrl+click adds or removes one and Shift+click a range, and the checkboxes stay.
SelectionModeSelectionMode = SelectionMode.NoneWhether items can be selected: one (a radio button on each) or several (a checkbox on each). Inside a form, the selected items post their ItemKey under SelectionName; bind Selection to follow them.
SelectionNamestring? (computed)The form field name the selection posts under, read back as a Selection with [SupplyParameterFromForm(Name = ...)]. Defaults to "{QueryPrefix}selected": give two selectable views in one form a QueryPrefix (or a name) each.
@bind-SelectionSelection?The selected items: keys on any page, or every item matching the filter except some. On a static page pass back the posted one. Selecting all that match is cleared when the filter or search changes.
ItemSelectableFunc<TItem, bool>?Whether an item can be selected; others show a disabled, unchecked box, and selecting the page or a range leaves them out. "Select all" (every matching item) can't know this rule: leave them out of the query you apply the Selection to.
SelectionActionsRenderFragment<Selection>?Actions on the selection, in a bar above the items, disabled until something is selected (on a DataGrid with a toolbar, the bar takes the toolbar's place while something is). Submit buttons in the surrounding form post the selection. A link can't be disabled, so it stays live. Without these there's no bar.
Types (2)
Selection
classThe items selected in a Table or ListView: some keys, or every item matching a filter and search except some keys (SelectAllMode.All). Bind it with @bind-Selection, or on a static page with [SupplyParameterFromForm(FormName = "...", Name = "...")] under the view's SelectionName. For a bulk action, Apply gives the selected items from a query.
| Member | Description |
|---|---|
None | Nothing selected. |
Of(IEnumerable<string> keys) | These keys selected. |
AllOf<TItem>(DataRequest<TItem> request) | |
Keys string[]? | The selected keys; with |
All bool = false | |
Filter string? | With |
Search string? | With |
KeyList string? | The keys as one JSON list, as the script posts a selection kept across pages: one field rather than one per key, which stays under the server's limit of 1,024 form values. Added to |
IsEmpty bool = true | Nothing is selected. |
Apply<TItem>(IQueryable<TItem> source, Expression<Func<TItem, string>> key) | |
Apply<TItem>(IQueryable<TItem> source, Expression<Func<TItem, string>> key, IReadOnlyList<DataField<TItem>> fields) | |
ApplyTree<TItem, TKey, TParent>(IQueryable<TItem> source, Expression<Func<TItem, TKey>> key, Expression<Func<TItem, TParent>> parent) | |
Contains(string key) | Whether the item with this key is selected (for |
Count(int? total) | How many are selected, given how many match; null when |
MatchesScope(Filter? filter, string? search) | Whether |
With(string key, bool selected) | A copy with this key selected or cleared. |
SelectionMode
enumHow many items can be selected.
| Value | Description |
|---|---|
None | No selection. The default. |
Single | One item, with a radio button on each. |
Multiple | Any number, with a checkbox on each; with script, a box to select them all (see |