Reordering
Since 0.1.0-alpha.20
The members for reordering, and the types they use. Every member of
IzzyBlazor.ListView<TItem> is on the ListView API.
Properties (8)
Reorderablebool = falseLets the user reorder the items: each gets a handle to drag, which also opens a menu (Move up, Move down, Move to top, Move to bottom) for moving without dragging; with DragWholeItem and an ItemMenu, the moves go in each item's ⋯ menu instead, and the item drags from anywhere. Needs an ItemKey and every item shown: no paging and no ItemsProvider. On interactive pages bind the order with @bind-Items; on static pages give it a Name inside a form and pass the posted ListOrder back as Order.
Namestring?For a Reorderable list on a static page, the prefix of the fields it posts: {Name}.Keys and {Name}.Move, bound as a ListOrder. Without it, a static page shows no handles.
OrderListOrder?For a Reorderable list on a static page, what the form posted: the list shows the posted order with the move applied, and focuses the moved item's handle (or ⋯ button).
SubmitOnMovebool = falseFor a Reorderable list on a static page with script, posts the form after each move, for pages that save every move. Otherwise moves stay in the page until the form is submitted. With JavaScript off, each move from an item's menu posts anyway.
DragWholeItembool = falseFor a Reorderable list, lets a drag start anywhere on an item, not only on its handle: with a mouse after a small move, on touch after a long press (so a swipe still scrolls the page). Links, buttons and fields in the item keep their presses; the item's own link (ItemHref) or button (OnItemClick) still works on a click. With an ItemMenu there are no handles: each item's ⋯ menu ends with a Move submenu (Move up, Move down, Move to top, Move to bottom); without one, the handle stays as the menu of moves.
Without JavaScript: Nothing drags; with an ItemMenu, the moves in each item's ⋯ menu post the form.
Zonestring?Makes the list a zone of the DropZoneGroup<T> around it: it shows the group's items whose zone is this one, and items move here from the group's other zones. Name each zone with AriaLabel, which also names it in the menu of moves.
Events (1)
Types (2)
ListMoveEventArgs
classA move in a reorderable ListView or between drop zones, before the list changes.
| Member | Description |
|---|---|
Item TItem | The item that moves. |
Key string | Its key. |
FromIndex int = 0 | Its place before the move, from 0, among the items of its zone (or the list). |
ToIndex int = 0 | Its place after the move, from 0, among the items of the zone it moves to (or the list). |
FromZone string? | The zone it moves from; null outside a |
ToZone string? | The zone it moves to; null outside a |
Cancel bool = false | Set to keep the item where it was, such as when saving the move failed. |
ListOrder
classWhat a reorderable ListView or a DropZoneGroup posts on a static page: its keys in the order shown (and in a group each item's zone), and the move a menu asked for. Bind it with [SupplyParameterFromForm(FormName = "...", Name = "...")] under the list's (or group's) Name, pass it back as Order so it shows the new order, and save Arrange (or, for zones, Arrange) when the post is the form's own submit (Move is null).
| Member | Description |
|---|---|
Keys string[]? | The items' keys, in the order the list showed them (after any moves made with script). |
Zones string[]? | In a group of zones, each item's zone, in the same order as |
Move string? | The move a handle's menu posted, such as |
Arrange<TItem>(IReadOnlyList<TItem> items, Func<TItem, string> key) | |
Arrange<TItem>(IReadOnlyList<TItem> items, Func<TItem, string> key, Func<TItem, string> zoneOf) | |
ZoneOf(string key) | The zone the post put an item in (its posted zone, or the move's), or null when the post didn't name it. |