Skip to content
IzzyBlazor

Enter all results ↑ ↓ move Esc close

Reordering rows

Since 0.1.0-alpha.20
Users put rows in their own order by dragging a handle or from its menu, and the grid posts or binds the new order.

The members for reordering rows, and the types they use. Every member of IzzyBlazor.DataGrid<TItem> is on the DataGrid API.

Properties (7)

ReorderableRowsbool = falseAdded in 0.1.0-alpha.21

Lets people put the rows in their own order: each row starts with a handle to drag, which also opens a menu (Move up, Move down, Move to top, Move to bottom) for moving without dragging. The handles work while the rows are in the grid's own order, and are disabled while it's sorted, filtered, searched or grouped, so leave those off: the order is the data. Needs an ItemKey and every row shown: Items, with no paging, ItemsProvider or Virtualize. On interactive pages bind the order with @bind-Items; on static pages give it an OrderName inside a form and pass the posted ListOrder back as Order.

ItemMovableFunc<TItem, bool>?Added in 0.1.0-alpha.21

Which rows can move; the others have no handle, and stay put while rows move past them.

OrderNamestring?Added in 0.1.0-alpha.21

For ReorderableRows on a static page, the prefix of the fields the order posts: {OrderName}.Keys and {OrderName}.Move, bound as a ListOrder. Without it, a static page shows no handles.

OrderListOrder?Added in 0.1.0-alpha.21

For ReorderableRows on a static page, what the form posted: the grid shows the posted order with the move applied, and focuses the moved row's handle.

SubmitOnMovebool = falseAdded in 0.1.0-alpha.21Static only

For ReorderableRows 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 a handle's menu posts anyway.

RowLabelFunc<TItem, string>? (computed)Added in 0.1.0-alpha.20

Names a row for screen readers, in its link and its checkbox. Defaults to ItemKey.

ItemKeyFunc<TItem, string>? (computed)Added in 0.1.0-alpha.20

A unique, stable key for each item, such as its id. Selection posts and binds these keys. Defaults to the item's string form.

Events (1)

OnMoveEventCallback<ListMoveEventArgs<TItem>>Added in 0.1.0-alpha.21Interactive only

Runs before a move changes the order, on interactive pages: save it here, or set Cancel to keep the row where it was. A dragged row stays where it was dropped while this runs, for up to 3 seconds.

Types (2)

ListMoveEventArgs

class

A move in a reorderable ListView or between drop zones, before the list changes.

ListMoveEventArgs members
MemberDescription
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 DropZoneGroup.

ToZone string?

The zone it moves to; null outside a DropZoneGroup.

Cancel bool = false

Set to keep the item where it was, such as when saving the move failed.

ListOrder

class

What 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).

ListOrder members
MemberDescription
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 Keys.

Move string?

The move a handle's menu posted, such as up:42; null when the form's own submit posted.

Dropped string?

In a group of zones, the key of the item the script moved last (a drag, or its menu with script), when the group posts after each move.

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.

Connection lost

Rejoining the server…