Server data
Since 0.1.0-alpha.20
The members for server data, and the types they use. Every member of
IzzyBlazor.DataGrid<TItem> is on the DataGrid API.
Properties (6)
GroupsProviderFunc<DataGroupRequest<TItem>, ValueTask<DataGroupResult>>?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.
Virtualizebool = falseDraws only the rows in view, on an interactive page; on a static page they load on scroll instead, by PageSize (50 if not set), up to 2,000 rows. Needs a MaxHeight, and rows of one line, as tall as RowHeight. An ItemsProvider must return a Total, and read each window's Skip and Take, not Page, as a window needn't start on a page. It can't take paging by cursor. Pages, and their footer, don't apply.
RowHeightdouble = 48The height of every row, in pixels, with Virtualize. Text past it is cut short. A control in a cell can't be cut short: a row with a checkbox or a ⋯ button needs at least 33. Defaults to 48.
MaxHeightLength?A height limit: the rows scroll and the header stays in view. Without one, a table with Grow on a page that fills a ShellScroll.Main shell's main area takes the height left instead.
ItemsProviderFunc<DataRequest<TItem>, ValueTask<DataResult<TItem>>>?Loads the items yourself, in place of Items: the request has the range (and in a Table the sort, the filter and the columns as fields), so request.ToResultAsync(query, ...) or request.Apply(query) does the work. An exception it throws shows "Couldn't load the rows." with Retry (and is logged); a request that was canceled is ignored.
@bind-PageSizeint?Items per page. Leave it out to show every item.
Types (5)
DataGroupRequest
recordWhat 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.
| Member | Description |
|---|---|
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: |
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 |
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: |
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
recordWhat a GroupsProvider returns.
| Member | Description |
|---|---|
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 |
DataRequest
recordWhat a data component (a Table<T>) asks its ItemsProvider for: a range of rows, sorted and filtered, or the page after a cursor. Apply it to a query with ToResultAsync or Apply; the component's columns say how each key reads an item, so a provider never maps keys to properties itself. It travels: to JSON with System.Text.Json, and to a query string with ToQueryString, for a WebAssembly app that calls an API, where Apply applies it through the fields the server declares.
| Member | Description |
|---|---|
Sort IReadOnlyList<SortField> | The sort, first key first; empty for the source's own order. |
Filter Filter? | The filter, or null for none. |
Search string? | Free text to look for, in the searchable fields (text, by default); null for none. |
Skip int = 0 | Rows to skip: any offset, such as 1,036 for a virtual-scrolling grid. |
Take int? | Rows to take; null for every row. |
Cursor string? | |
Parent string? | For a |
FilterBranch bool = false | For a |
NeedsTotal bool = true | Whether the component needs the total count. False when it pages by cursor, where the total is optional. |
CancellationToken CancellationToken = CancellationToken.None | Canceled when the component no longer needs this answer (a newer request, or it went away). |
Page int = 1 | |
Apply(IQueryable<TItem> source) | Filters, searches, sorts and takes the range of a query, with the component's fields. EF Core translates it. |
Apply(IQueryable<TItem> source, IReadOnlyList<DataField<TItem>> fields) | Filters, searches, sorts and takes the range of a query, mapping keys through these fields only: on a server, for a request that came over the wire. A filter on a key that isn't one of them (or isn't filterable) matches nothing, and a sort by one is left out, so a request can't reach other properties. |
ApplyFiltering(IQueryable<TItem> source) | Keeps what the filter and search match, with the component's fields: count this for the total. |
ApplyFiltering(IQueryable<TItem> source, IReadOnlyList<DataField<TItem>> fields) | Keeps what the filter and search match, through these fields only. |
ApplySorting(IQueryable<TItem> source) | Sorts a query, with the component's fields. |
ApplySorting(IQueryable<TItem> source, IReadOnlyList<DataField<TItem>> fields) | Sorts a query by the sortable fields named in |
ToODataQuery() | The request as OData query options, for a provider whose API is an OData endpoint: |
ToODataQuery(IReadOnlyList<DataField<TItem>> fields) | The request as OData query options, with values written as these fields' types. |
ToQueryString() | The request as a query string, for a GET API: |
ToResult(IQueryable<TItem> source) | The count of what the filter keeps (when |
ToResult(IQueryable<TItem> source, IReadOnlyList<DataField<TItem>> fields) | The count and items, through these fields only (see |
ToResultAsync(IQueryable<TItem> source, Func<IQueryable<TItem>, CancellationToken, Task<int>> count, Func<IQueryable<TItem>, CancellationToken, Task<List<TItem>>> list) | The count of what the filter keeps (only when |
ToResultAsync(IQueryable<TItem> source, IReadOnlyList<DataField<TItem>> fields, Func<IQueryable<TItem>, CancellationToken, Task<int>> count, Func<IQueryable<TItem>, CancellationToken, Task<List<TItem>>> list) | The count and items through your async methods, mapping keys through these fields only. |
ToTreeResult<TKey, TParent>(IQueryable<TItem> source, Expression<Func<TItem, TKey>> key, Expression<Func<TItem, TParent>> parent) | |
ToTreeResultAsync<TKey, TParent>(IQueryable<TItem> source, Expression<Func<TItem, TKey>> key, Expression<Func<TItem, TParent>> parent, Func<IQueryable<TItem>, CancellationToken, Task<int>> count, Func<IQueryable<TItem>, CancellationToken, Task<List<TItem>>> list) |
DataResult
recordWhat an ItemsProvider returns: the rows asked for, and the total count or the cursors of the pages around them.
| Member | Description |
|---|---|
Items IReadOnlyList<TItem> | The rows. |
Total int? | How many rows match in all. A Table with numbered pages ( |
Next string? | The cursor of the page after this one, or null on the last page. Used when the component pages by cursor. |
Previous string? | The cursor of the page before this one, if your data source gives one. Without it a Table goes back to cursors it has seen on interactive pages; on static pages Previous is unavailable past the second page (First still works). |
Length
structA width, height or flex basis: a size token, a keyword, or a CSS length built with a factory such as Rem.
| Member | Description |
|---|---|
Sm | 640px (matches the |
Md | 768px (matches the |
Lg | 1024px (matches the |
Xl | 1280px (matches the |
Prose | A comfortable reading width, 68 characters. |
Full | 100% of the containing block. |
Auto |
|
FitContent |
|
MinContent |
|
MaxContent |
|
Px(double value) | Pixels. |
Rem(double value) | Root ems (16px each by default). |
Percent(double value) | Percent of the containing block. |
Ch(double value) | Character widths, for text measures. |
Vw(double value) | Percent of the viewport width. |
Dvh(double value) | Percent of the dynamic viewport height (accounts for mobile browser bars). |
Of(string css) | Any CSS length, such as |
Css string | The CSS value this length renders as. |