Skip to content
IzzyBlazor 0.1.0-alpha.20

Enter all results ↑ ↓ move Esc close

Grouping

Since 0.1.0-alpha.20
Group by columns, a page of groups at a time, with values for each group.

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

Properties (9)

Groupablebool = falseAdded in 0.1.0-alpha.20

Lets people group by columns, from a header's menu. Grouped, the grid's pages count top-level groups, so a group is never split, and each group's count and aggregates are the whole group's. With an ItemsProvider, it needs a GroupsProvider.

@bind-Groupstring?Added in 0.1.0-alpha.20 @bind: Interactive only

The grouping, outermost first, such as "status,-customer" (- for descending); null for InitialGroup. Works without Groupable, for a grouping people can't change. Binding it (@bind-Group) on an interactive page keeps it in the component instead of the URL.

InitialGroupstring?Added in 0.1.0-alpha.20

The grouping when the URL has none, such as "status".

GroupsOpenbool = falseAdded in 0.1.0-alpha.20

Whether groups start open. They start closed by default, which is what a page of groups is for.

@bind-OpenGroupsIReadOnlyList<string>?Added in 0.1.0-alpha.20 @bind: Interactive only

Which groups are open, each by its values joined with /, escaped, such as "Shipped/Acme"; "*" is all of them, and "!Shipped" an exception to that. Binding it on an interactive page keeps it in the component.

GroupRowLimitint = 100Added in 0.1.0-alpha.20

The most rows drawn in one open group. Past it, the group says how many it has and links to showing only that group, with the grid's pages. Defaults to 100.

GroupPanelbool = falseAdded in 0.1.0-alpha.20

Keeps the bar of what's grouped above the grid while nothing is, saying a header can be dragged there. Without it the bar shows only while grouped, and the first grouping is from a header's menu. Dragging needs script and a mouse or pen; the menu works everywhere.

Without JavaScript: With JavaScript off, the bar shows what's grouped, and headers can't be dragged to it.

ShowGroupedColumnsbool = falseAdded in 0.1.0-alpha.20

Keeps a grouped column in the table. By default it leaves, as each group's row says its value.

GroupsProviderFunc<DataGroupRequest<TItem>, ValueTask<DataGroupResult>>?Added in 0.1.0-alpha.20

Counts and aggregates for an ItemsProvider, which a column's Aggregate needs. It gets one request for each level of groups, and one with no keys for the grand total. Answer it from a query with request.ToResultAsync. With Items, the grid works these out itself.

Parts (1)

Components written inside DataGrid, and the columns' members, which PropertyColumn and TemplateColumn share.

PropertyColumn<TItem, TValue>

A column that shows one property of each item, formatted, and can sort by it. The title and sort key come from the property ([Display(Name)] is used when present).

Groupablebool = trueAdded in 0.1.0-alpha.20

In a grid that groups, whether this column can be grouped by. Defaults to true, for a column with one value to compare.

GroupByExpression<Func<TItem, object?>>?Added in 0.1.0-alpha.20

What to group by, when it isn't the column's value: for a TemplateColumn<T>, or a coarser key such as o => o.Placed.Year. It runs in the database, so keep it to what yours can translate. "Show only this group" isn't offered, as no filter on the column can say it.

GroupFormatstring? (computed)Added in 0.1.0-alpha.20

A .NET format string for a group's value. Defaults to the column's own when it has no GroupBy.

GroupTemplateRenderFragment<DataGridGroup>?Added in 0.1.0-alpha.20

A group's label, in place of the column's title and the value. The count stays beside it.

Types (3)

DataGridGroup

record

A group, for a column's GroupTemplate.

DataGridGroup members
MemberDescription
Value object?

Its value, or null for none.

Text string

Its value as the column shows it.

Group DataGroup

Its count and aggregates, for the whole group.

Level int

Its level, from 0.

IsOpen bool

Whether it's open.

DataGroupRequest

record

What a DataGrid asks its GroupsProvider for: one level of groups with their counts and aggregates, or, with no Keys, the one group of everything that matches, which is the grand total. Rows aren't part of it: an open group's rows come from the ItemsProvider, with the group's values in its filter. Answer it with ToResultAsync.

DataGroupRequest members
MemberDescription
Keys IReadOnlyList<SortField>

The fields to group by, outermost first, and the order of each; empty for the grand total.

Aggregates IReadOnlyList<DataAggregateField>

What to work out for each group, besides its count.

Filter Filter?

The filter, or null for none.

Search string?

Free text to look for, in the searchable fields; null for none.

Skip int = 0

Groups to skip.

Take int?

Groups to take; null for every group.

NeedsTotal bool = false

Whether the component needs how many groups there are in all.

CancellationToken CancellationToken = CancellationToken.None

Canceled when the component no longer needs this answer.

ToQueryString()

The request as a query string, for a GET API: group=status,-customer&aggregate=total:sum&skip=20&take=10&filter=...&search=..., with total=true when it needs the number of groups. Read it back with Parse.

ToResult(IQueryable<TItem> source)

The groups, from an in-memory list or a synchronous query, with the component's fields.

ToResult(IQueryable<TItem> source, IReadOnlyList<DataField<TItem>> fields)

The groups, through these fields only, for a request that came over the wire: a key that isn't Groupable or an aggregate that isn't Aggregatable is left out, so a request can't reach other properties.

ToResultAsync(IQueryable<TItem> source, Func<IQueryable<object?[]>, CancellationToken, Task<int>> count, Func<IQueryable<object?[]>, CancellationToken, Task<List<object?[]>>> list)

The groups through your async methods, so Core needs no EF Core: count: (q, ct) => q.CountAsync(ct), list: (q, ct) => q.ToListAsync(ct).

ToResultAsync(IQueryable<TItem> source, IReadOnlyList<DataField<TItem>> fields, Func<IQueryable<object?[]>, CancellationToken, Task<int>> count, Func<IQueryable<object?[]>, CancellationToken, Task<List<object?[]>>> list)

The groups through your async methods, through these fields only.

DataGroupResult

record

What a GroupsProvider returns.

DataGroupResult members
MemberDescription
Groups IReadOnlyList<DataGroup>

The groups, in order. For a grand total, one.

Total int?

How many groups there are in all, when the request's NeedsTotal asks.

Connection lost

Rejoining the server…