Columns
Since 0.1.0-alpha.20
The members for columns, and the types they use. Every member of
IzzyBlazor.DataGrid<TItem> is on the DataGrid API.
Properties (6)
LayoutKeystring?Remembers how each person has arranged the columns, in a cookie under this name, so the server draws it on the first paint. Letters, digits, - and _. With neither this nor Layout, nothing is stored.
@bind-LayoutDataGridLayout?How the columns are arranged, in place of the cookie: bind it (@bind-Layout) to keep layouts yourself, such as per user in a database. Null leaves them as declared.
LayoutSaveUrlstring?With script, an address the app maps to save a person's layout: the grid posts it there as JSON when it changes, for a static page that passes its own Layout.
ResizableColumnsbool = falseLets people resize columns: by dragging a handle at the header's end, by double-clicking it to fit, by Shift+Left and Shift+Right, or from the header's menu. The grid scrolls if it grows. Needs script, and on a static page a LayoutKey or LayoutSaveUrl.
ReorderableColumnsbool = falseLets people move columns: by dragging a header, by Alt+Left and Alt+Right, or from the header's menu, which can also freeze them. Frozen columns move among themselves. Needs script, and on a static page a LayoutKey or LayoutSaveUrl.
ColumnPickerbool = falseA button above the grid listing the columns to show or hide, and to put back as declared. Needs script, and on a static page a LayoutKey or LayoutSaveUrl.
Parts (2)
Components written inside DataGrid, and the columns' members, which PropertyColumn and TemplateColumn share.
DataGridColumnPicker
Puts a DataGrid's Columns button, from ColumnPicker, among your toolbar items. It stays in the bar, at the end unless Position says otherwise.
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).
Titlestring?The header text.
AlignCellAlign? (computed)How the cells line up. Defaults to the end for numbers and the start otherwise.
WidthLength?The column width, such as Length.Rem(8). In a grid, a fixed length: not a percent or a keyword.
MinWidthLength? (computed)How narrow a column without a Width can get before the grid scrolls sideways. Defaults to 8rem. Not for a Table, whose columns size to their content.
FrozenColumnFrozen = ColumnFrozen.NoneKeeps this column in view at the grid's start or end while the rest scrolls sideways, and draws it at that edge wherever it's declared. It needs a Width. Not for a Table.
MaxWidthLength?In a grid with ResizableColumns, how wide people can make this column. No limit by default.
Resizablebool = trueIn a grid with ResizableColumns, whether people can resize this column. Defaults to true.
Reorderablebool = trueIn a grid with ReorderableColumns, whether people can move this column. Defaults to true.
Pickablebool = trueIn a grid with a ColumnPicker, whether people can hide this column. Defaults to true.
Visiblebool = trueWhether the column shows at first in a DataGrid. Hidden, it's still in the column picker, where people can show it, unless Pickable is false, and can still be filtered by and edited. This isn't access control: its values are sent once it's shown, so leave out a column someone mustn't see.
Types (5)
CellAlign
enumHow a table cell's content lines up.
| Value | Description |
|---|---|
Start | The start (left in left-to-right languages). The default for text. |
Center | Centered. |
End | The end (right in left-to-right languages). The default for numbers. |
ColumnFrozen
enumWhere a DataGrid column stays in view while the rest scrolls sideways.
| Value | Description |
|---|---|
None | It scrolls with the rest. The default. |
Start | At the grid's start (the left, or the right in a right-to-left page). |
End | At the grid's end. |
DataGridLayout
recordHow one person has arranged a DataGrid's columns: only what differs from the columns as declared. Serializable, to keep per user in a database. Sort, filter and page aren't part of it: they're in the address, so one link shows the same rows to everyone.
| Member | Description |
|---|---|
Parse(string? json) | A layout from |
Columns IReadOnlyList<DataGridColumnLayout> | The columns that differ from their declaration. |
Column(string key) | A column's entry, by its key (its |
ToJson() | The layout as JSON, as a cookie holds it. |
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. |
ToolbarPosition
enumWhere an item of a Toolbar sits.
| Value | Description |
|---|---|
Start | At the start (the left in left-to-right text), the default. |
Center | In the middle, kept centered between the start and the end. |
End | At the end, before the "…" menu. |