Data grid

The <FluentDataGrid> component is used to display tabular data. The <FluentDataGridRow> and <FluentDataGridCell> components are typically created programmatically by the parent grid but some authors may find it useful to create them manually.

Important

As of version 4.11.0, the DataGrid uses standard HTML table elements for rendering the grid (previously web components were used for this). When upgrading to this version, please be aware of the following:
  • A lot of changes have been made to the structure of the rendered content and the class names used. If you have been overriding grid classes in your own code, these probably no longer work.
  • When you have rows in a table with content that needs to span multiple lines, you now need to use and set the new MultiLine (bool) parameter of the FluentDataGrid. Previously this could be done by setting a RowClass on a column but that does not work anymore
  • The parameter ResizeLabel has been removed in favor of 3 new parameters. This makes changing strings in the DataGrid UI easier. See Change strings used in the UI for more information.
  • It is currently not possible to use the OnRowFocus and OnCellFocus event callbacks. You can use the OnRowClick, OnRowDoubleClick and OnCellClick alternatives. As of v4.11.1 the OnCellFocus event callback will be operational again. For OnRowFocus, we are waiting for the necessary support being added by the different browsers. See https://chromestatus.com/feature/6237396851228672 for more information.

Do not use the RowStyle parameter to dynamically update a row style after rendering (for example to highlight a row which was clicked on) as this will interfere with the DataGrid scripts that use this attribute as well. Use the RowClass instead.

Accessibility

You can use the Arrow keys to navigate through a DataGrid. When a header cell is focused and the column is sortable, you can use the Tab key to select the sort button. Pressing the Enter key will toggle the sorting direction. Pressing Ctrl+Enter removes the column sorting and restores the default/start situation with regards to sorting. You cannot remove the default grid sorting with this key combination.

When a header cell is focused and the column allows setting options, you can use the Tab key to select the options button. Pressing the Enter key then will toggle the options popover. Pressing Esc closes the popover .

When a grid allows resizing of the columns, you can use the + and - keys to resize the column the focused header belongs to. Incrementing/decrementing width is done in steps of 10 pixels at a time. You can reset to the original initial column widths by pressing Shift + r.

When a row cell is focused and the grid contains a SelectColumn column, you can use the Enter key to select or unselect the current row.

Sorting

The DataGrid supports sorting by clicking on the column headers. The default sort direction is ascending. Clicking on the same column header again will toggle the sort direction. A sort can be removed by right clicking (or by pressing Shift+R) on the header column (with exception of the default sort).

Row size

As of v4.11.0, the Datagrid offers a RowSize parameter which allows you to use different preset row heights. The value uses the DataGridRowSize enumeration for its type. When using Virtualize, the ItemSize value is used is still used to indicate the row height.

Resizing columns

The DataGrid supports resizing columns by both dragging and through column option popups in exact or discrete mode. As of v4.12.0, the default behavior is to initiate a resize action by dragging the column edge on every row. In earlier versions this could only be done on the header column edge. To go back to the previous behavior, the new (as of v4.12.1) ResizeColumnOnAllRows parameter can be set to false.

The following parameters can be used to tweak the resize handle appearance:

.fluent-data-grid {
        --fluent-data-grid-resize-handle-color: var(--accent-fill-rest);
        --fluent-data-grid-resize-handle-width: 1px;
        --fluent-data-grid-header-opacity: 0.5;
        

DisplayMode

The DataGrid supports 2 different display modes through the DisplayMode parameter: DataGridDisplayMode.Grid (default) and DataGridDisplayMode.Table. When set to Grid, the GridTableColumns parameter cam be used set specify column widths in fractions. It basically provides an HTML table element with a display: grid; style. The Table mode uses standard HTML table elements and rendering. Column widths in that mode are best specified through the Width parameter of the columns.

Specifically when using Virtualize, it is higly recommended to use the Table display mode as the Grid mode can exhibit some odd behaviour when scrolling.

Change strings used in the UI

The DataGrid has a number of strings that are used in the UI. These can be changed by setting the ColumnOptionLabels, ColumnResizeLabels and ColumnSortLabels parameters. Each of these parameters is a record that contains properties for the strings that that specific piece of UI is using. There is a default implementation for each record. See below for a simplified example on how you can change these strings.

private ColumnResizeLabels _resizeLabels = ColumnResizeLabels.Default;
:
:
 protected override async Task OnInitializedAsync()
 {
     _resizeLabels = ColumnResizeLabels.Default with
     {
         ExactLabel = "...",
         ResizeMenu = "..."

     };
:
:

You only need to override the values that you actually want to change.

Using the DataGrid component with EF Core

If you want to use the FluentDataGrid with data provided through EF Core, you need to install an additional package so the grid knows how to resolve queries asynchronously for efficiency.

Installation

Install the package by running the command:
dotnet add package Microsoft.FluentUI.AspNetCore.Components.DataGrid.EntityFrameworkAdapter

Usage

In your Program.cs file you need to add the following after the builder.Services.AddFluentUIComponents(); line:
builder.Services.AddDataGridEntityFrameworkAdapter();

Using the DataGrid component with OData

Added in 4.11.0

If you want to use the FluentDataGrid with data provided through OData, you need to install an additional package so the grid knows how to resolve queries asynchronously for efficiency.

Installation

Install the package by running the command:
dotnet add package Microsoft.FluentUI.AspNetCore.Components.DataGrid.ODataAdapter

Usage

In your Program.cs file you need to add the following after the builder.Services.AddFluentUIComponents(); line:
builder.Services.AddDataGridODataAdapter();

Examples

See the following pages for examples and additional documentation on the situations that ech example shows.

Basics

Getting started Typical grid usage

Layout

...Content parameters Auto fit Auto items per page Custom paging Multi line text in cells Table with scrollbars

Sorting

Custom comparer Custom sorting

Columns

Single/Multi select Dynamic columns Header generation Template columns More template columns

Advanced

Virtualized grid Remote data Manual grid

Documentation

FluentDataGrid<TGridItem> Class

Parameters

Name
Type
Default
Description
AutoFitbool
False
Sets GridTemplateColumns to automatically fit the columns to the available width as best it can.
AutoFocusbool
False
Gets or sets a value indicating whether the grids' first cell should be focused.
AutoItemsPerPagebool
False
Automatically fit the number of items per page to the available height.
ChildContentRenderFragment?
Gets or sets the child components of this instance. For example, you may define columns by adding
components derived from the ColumnBase base class.
ColumnOptionsLabelsColumnOptionsLabels
Labels used in the column options UI.
ColumnResizeLabelsColumnResizeLabels
(Aria) Labels used in the column resize UI.
ColumnSortLabelsColumnSortLabels
Labels used in the column sort UI.
DisplayModeDataGridDisplayMode
Grid
Gets or set the DataGridDisplayMode of the grid.
Default is 'Grid'.
When set to Grid, GridTemplateColumns can be used to specify column widths.
When set to Table, widths need to be specified at the column level.
When using Virtualize, it is recommended to use Table.
EmptyContentRenderFragment?
If specified, grids render this fragment when there is no content.
GenerateHeaderGenerateHeaderOption?
Default
Gets or sets a value indicating whether the grid should automatically generate a header row and its type.
See GenerateHeaderOption
GridTemplateColumnsstring?
Gets or sets the value that gets applied to the css gridTemplateColumns attribute of child rows.
Can be specified here or on the column level with the Width parameter but not both.
Needs to be a valid CSS string of space-separated values, such as 'auto 1fr 2fr 100px'.
HeaderCellAsButtonWithMenubool
False
If true, enables the new style of header cell that includes a button to display all column options through a menu.
IsFixedbool
False
Gets or sets a value indicating whether the grid's dataset is not expected to change during its lifetime.
When set to true, reduces automatic refresh checks for better performance with static datasets.
Default is false to maintain backward compatibility.
ItemKeyFunc<TGridItem, Object>
Optionally defines a value for @key on each rendered row. Typically this should be used to specify a
unique identifier, such as a primary key value, for each data item.

This allows the grid to preserve the association between row elements and data items based on their
unique identifiers, even when the instances are replaced by new copies (for
example, after a new query against the underlying data store).

If not set, the @key will be the instance itself.
ItemsIQueryable<TGridItem>?
Gets or sets a queryable source of data for the grid.

This could be in-memory data converted to queryable using the
Queryable.AsQueryable(IEnumerable) extension method,
or an EntityFramework DataSet or an IQueryable derived from it.

You should supply either Items or ItemsProvider, but not both.
ItemSizefloat
32
This is applicable only when using Virtualize. It defines an expected height in pixels for
each row, allowing the virtualization mechanism to fetch the correct number of items to match the display
size and to ensure accurate scrolling.
ItemsProviderGridItemsProvider<TGridItem>?
Gets or sets a callback that supplies data for the rid.

You should supply either Items or ItemsProvider, but not both.
Loadingbool?
Gets or sets a value to indicate the grid loading data state.
If not set and a ItemsProvider is present, the grid will show LoadingContent until the provider's first return.
LoadingContentRenderFragment?
Gets or sets the content to render when Loading is true.
A default fragment is used if loading content is not specified.
MultiLinebool
False
Gets or sets a value indicating whether the grid should allow multiple lines of text in cells.
Cannot be used together with Virtualize.
NoTabbingbool
False
Gets or sets a value indicating whether the component will not add itself to the tab queue.
Default is false.
OverscanCountint
3
This is applicable only when using Virtualize. It defines how many additional items will be rendered
before and after the visible region to reduce rendering frequency during scrolling. While higher values can improve
scroll smoothness by rendering more items off-screen, they can also increase initial load times. Finding a balance
based on your data set size and user experience requirements is recommended. The default value is 3.
PaginationPaginationState?
Optionally links this FluentDataGrid instance with a PaginationState model,
causing the grid to fetch and render only the current page of data.

This is normally used in conjunction with a FluentPaginator component or some other UI logic
that displays and updates the supplied PaginationState instance.
RefreshItemsFunc<GridItemsProviderRequest<TGridItem>, Task>?
Gets or sets a callback which will be called if there is a change in pagination, ordering or if a RefreshDataAsync is forced.

You must supply Items if you use this callback.
ResizableColumnsbool
False
If true, renders draggable handles around the column headers and adds a button to invoke a resize UI.
This allows the user to resize columns manually. Size changes are not persisted.
ResizeColumnOnAllRowsbool
True
Gets or sets a value indicating whether column resize handles should extend the full height of the grid.
When true, columns can be resized by dragging from any row. When false, columns can only be resized
by dragging from the column header. Default is true.
ResizeTypeDataGridResizeType?
To comply with WCAG 2.2, a one-click option should be offered to change column widths. We provide such an option through the
ColumnOptions UI. This parameter allows you to enable or disable this resize UI.Enable it by setting the type of resize to perform
Discrete: resize by a 10 pixels at a time
Exact: resize to the exact width specified (in pixels)
Note: This does not affect resizing by mouse dragging, just the keyboard driven resize.
RowClassFunc<TGridItem, string>?
Optionally defines a class to be applied to a rendered row.
RowSizeDataGridRowSize
Small
Gets or sets the size of each row in the grid based on the DataGridRowSize enum.
RowStyleFunc<TGridItem, string>?
Optionally defines a style to be applied to a rendered row.
Do not use to dynamically update a row style after rendering as this will interfere with the script that use this attribute. Use RowClass instead.
SaveStateInUrlbool
False
Gets or sets a value indicating whether the grid should save its paging state in the URL.
This is an experimental feature, which might cause unwanted jumping in the page when you change something in the grid.
SaveStatePrefixstring?
Gets or sets a prefix to use when saving the grid state in the URL.
ShowHoverbool
False
Gets or sets a value indicating whether the grid should show a hover effect on rows.
SortByAscendingbool?
False
UseMenuServicebool
True
Use IMenuService to create the menu, if this service was injected.
This value must be defined before the component is rendered (you can't change it during the component lifecycle).
Default, true.
Virtualizebool
False
If true, the grid will be rendered with virtualization. This is normally used in conjunction with
scrolling and causes the grid to fetch and render only the data around the current scroll viewport.
This can greatly improve the performance when scrolling through large data sets.

If you use Virtualize, you should supply a value for ItemSize and must
ensure that every row renders with the same constant height.

Generally it's preferable not to use Virtualize if the amount of data being rendered
is small or if you are using pagination.

EventCallbacks

Name
Type
Description
OnCellClickEventCallback<FluentDataGridCell<TGridItem>>
Gets or sets a callback when a cell is clicked.
OnCellFocusEventCallback<FluentDataGridCell<TGridItem>>
Gets or sets a callback when a row is focused.
OnRowClickEventCallback<FluentDataGridRow<TGridItem>>
Gets or sets a callback when a row is clicked.
OnRowDoubleClickEventCallback<FluentDataGridRow<TGridItem>>
Gets or sets a callback when a row is double-clicked.
OnRowFocusEventCallback<FluentDataGridRow<TGridItem>>
Gets or sets a callback when a row is focused.
As of 4.11 a row is a tr element with a 'display: contents'. Browsers can not focus such elements currently, but work is underway to fix that.

Methods

Name
Parameters
Type
Description
CloseColumnOptionsAsyncTask
Closes the ColumnBase.ColumnOptions UI that was previously displayed.
DisposeAsyncValueTask
OnKeyDownAsyncFluentKeyCodeEventArgs args
Task
RefreshDataAsyncbool force
Task
Instructs the grid to re-fetch and render the current data from the supplied data source
(either Items or ItemsProvider).
RemoveSortByColumnAsyncColumnBase<TGridItem> column
Task
Removes the grid's sort on double click for the currently sorted column if it's not a default sort column.
RemoveSortByColumnAsyncTask
Removes the grid's sort on double click for the currently sorted column if it's not a default sort column.
ResetColumnWidthsAsyncTask
Resets the column widths to their initial values as specified with the GridTemplateColumns parameter.
If no value is specified, the default value is '1fr' for each column.
SetColumnWidthDiscreteAsyncint? columnIndex
float widthChange
Task
Resizes the column width by a discrete amount.
SetColumnWidthExactAsyncint columnIndex
int width
Task
Resizes the column width to the exact width specified (in pixels).
SetLoadingStatebool? loading
void
ShowColumnOptionsAsyncColumnBase<TGridItem> column
Task
Displays the ColumnBase.ColumnOptions UI for the specified column index,
closing any other column options UI that was previously displayed. If the index is out of range, nothing happens.
ShowColumnOptionsAsyncstring title
Task
Displays the ColumnBase.ColumnOptions UI for the specified column index,
closing any other column options UI that was previously displayed. If the index is out of range, nothing happens.
ShowColumnOptionsAsyncint index
Task
Displays the ColumnBase.ColumnOptions UI for the specified column index,
closing any other column options UI that was previously displayed. If the index is out of range, nothing happens.
ShowColumnResizeAsyncColumnBase<TGridItem> column
Task
Displays the column resize UI for the specified column, closing any other column
resize UI that was previously displayed.
ShowColumnResizeAsyncstring title
Task
Displays the column resize UI for the specified column, closing any other column
resize UI that was previously displayed.
ShowColumnResizeAsyncint index
Task
Displays the column resize UI for the specified column, closing any other column
resize UI that was previously displayed.
SortByColumnAsyncColumnBase<TGridItem> column
SortDirection direction
Task
Sorts the grid by the specified column index. If the index is out of range, nothing happens.
SortByColumnAsyncstring title
SortDirection direction
Task
Sorts the grid by the specified column index. If the index is out of range, nothing happens.
SortByColumnAsyncint index
SortDirection direction
Task
Sorts the grid by the specified column index. If the index is out of range, nothing happens.
UpdateItemsPerPageAsyncint visibleRows
Task
Updates the Paginations ItemPerPage parameter.
Guards the CurrentPageIndex from getting greater than the LastPageIndex

PropertyColumn<TGridItem, TProp> Class

Parameters

Name
Type
Default
Description
AlignAlign
Start
If specified, controls the justification of header and grid cells for this column.
ColumnOptionsRenderFragment?
If specified, indicates that this column has this associated options UI. A button to display this
UI will be included in the header cell by default.

If ColumnBase.HeaderCellItemTemplate is used, it is left up to that template to render any relevant
'show options' UI and invoke the grid's ShowColumnOptionsAsync(ColumnBase{})).
ComparerIComparer<TProp>?
Optionally specifies how to compare values in this column when sorting.

Using this requires the type to implement System.IComparable.
Filteredbool?
Gets or sets a value indicating whether the data is currently filtered by this column.

The default value is false.
Formatstring?
Optionally specifies a format string for the value.

Using this requires the type to implement System.IFormattable.
HeaderCellItemTemplateRenderFragment<ColumnBase<TGridItem>>?
Gets or sets an optional template for this column's header cell.
If not specified, the default header template includes the ColumnBase.Title along with any applicable sort indicators and options buttons.
HeaderCellTitleTemplateRenderFragment<ColumnBase<TGridItem>>?
Gets or sets a template for the title content of this column's header cell.
If not specified, the default header template includes the ColumnBase.Title.
HeaderTooltipstring?
Gets or sets the tooltip text for the column header.
Indexint
0
Gets or sets the index (1-based) of the column
InitialSortDirectionSortDirection
Auto
Gets or sets the initial sort direction.
if ColumnBase.IsDefaultSortColumn is true.
IsDefaultSortColumnbool
False
Gets or sets a value indicating whether this column should be sorted by default.
PlaceholderTemplateRenderFragment<PlaceholderContext>?
If specified, virtualized grids will use this template to render cells whose data has not yet been loaded.
PropertyExpression<Func<TGridItem, TProp>>
Defines the value to be displayed in this column's cells.
PropertyInfoPropertyInfo?
Sortablebool?
Gets or sets a value indicating whether the data should be sortable by this column.

The default value may vary according to the column type (for example, a TemplateColumn
or PropertyColumn`2 is sortable by default if anyTemplateColumn.SortBy
or PropertyColumn`2.SortBy parameter is specified).
SortByIGridSort<TGridItem>?
Gets or sets the sorting rules for a column.
Titlestring?
Gets or sets the title text for the column.
This is rendered automatically if ColumnBase.HeaderCellItemTemplate is not used.
Tooltipbool
False
If true, generates a title and aria-label attribute for the cell contents
TooltipTextFunc<TGridItem, string>?
Gets or sets the function that defines the value to be used as the tooltip and aria-label in this column's cells
Widthstring?
Gets or sets the width of the column.
Use either this or the FluentDataGrid GridTemplateColumns parameter but not both.
Needs to be a valid CSS width value like '100px', '10%' or '0.5fr'.

TemplateColumn<TGridItem> Class

Parameters

Name
Type
Default
Description
AlignAlign
Start
If specified, controls the justification of header and grid cells for this column.
ChildContentRenderFragment<TGridItem>
Gets or sets the content to be rendered for each row in the table.
ColumnOptionsRenderFragment?
If specified, indicates that this column has this associated options UI. A button to display this
UI will be included in the header cell by default.

If ColumnBase.HeaderCellItemTemplate is used, it is left up to that template to render any relevant
'show options' UI and invoke the grid's ShowColumnOptionsAsync(ColumnBase{})).
Filteredbool?
Gets or sets a value indicating whether the data is currently filtered by this column.

The default value is false.
HeaderCellItemTemplateRenderFragment<ColumnBase<TGridItem>>?
Gets or sets an optional template for this column's header cell.
If not specified, the default header template includes the ColumnBase.Title along with any applicable sort indicators and options buttons.
HeaderCellTitleTemplateRenderFragment<ColumnBase<TGridItem>>?
Gets or sets a template for the title content of this column's header cell.
If not specified, the default header template includes the ColumnBase.Title.
HeaderTooltipstring?
Gets or sets the tooltip text for the column header.
Indexint
0
Gets or sets the index (1-based) of the column
InitialSortDirectionSortDirection
Auto
Gets or sets the initial sort direction.
if ColumnBase.IsDefaultSortColumn is true.
IsDefaultSortColumnbool
False
Gets or sets a value indicating whether this column should be sorted by default.
PlaceholderTemplateRenderFragment<PlaceholderContext>?
If specified, virtualized grids will use this template to render cells whose data has not yet been loaded.
Sortablebool?
Gets or sets a value indicating whether the data should be sortable by this column.

The default value may vary according to the column type (for example, a TemplateColumn
or PropertyColumn`2 is sortable by default if anyTemplateColumn.SortBy
or PropertyColumn`2.SortBy parameter is specified).
SortByIGridSort<TGridItem>?
Titlestring?
Gets or sets the title text for the column.
This is rendered automatically if ColumnBase.HeaderCellItemTemplate is not used.
Tooltipbool
False
If true, generates a title and aria-label attribute for the cell contents
TooltipTextFunc<TGridItem, string>?
Gets or sets the function that defines the value to be used as the tooltip and aria-label in this column's cells
Widthstring?
Gets or sets the width of the column.
Use either this or the FluentDataGrid GridTemplateColumns parameter but not both.
Needs to be a valid CSS width value like '100px', '10%' or '0.5fr'.

SelectColumn<TGridItem> Class

Parameters

Name
Type
Default
Description
AlignAlign
Start
If specified, controls the justification of header and grid cells for this column.
ChildContentRenderFragment<TGridItem>
Gets or sets the content to be rendered for each row in the table.
ColumnOptionsRenderFragment?
If specified, indicates that this column has this associated options UI. A button to display this
UI will be included in the header cell by default.

If ColumnBase.HeaderCellItemTemplate is used, it is left up to that template to render any relevant
'show options' UI and invoke the grid's ShowColumnOptionsAsync(ColumnBase{})).
Filteredbool?
Gets or sets a value indicating whether the data is currently filtered by this column.

The default value is false.
HeaderCellItemTemplateRenderFragment<ColumnBase<TGridItem>>?
Gets or sets an optional template for this column's header cell.
If not specified, the default header template includes the ColumnBase.Title along with any applicable sort indicators and options buttons.
HeaderCellTitleTemplateRenderFragment<ColumnBase<TGridItem>>?
Gets or sets a template for the title content of this column's header cell.
If not specified, the default header template includes the ColumnBase.Title.
HeaderTooltipstring?
Gets or sets the tooltip text for the column header.
IconCheckedIcon?
Gets or sets the Icon to be rendered when the row is selected.
IconIndeterminateIcon?
Preview: 
Gets or sets the Icon to be rendered when some but not all rows are selected.
Only when SelectColumn.SelectMode is Multiple.
IconUncheckedIcon?
Gets or sets the Icon to be rendered when the row is non selected.
Indexint
0
Gets or sets the index (1-based) of the column
InitialSortDirectionSortDirection
Auto
Gets or sets the initial sort direction.
if ColumnBase.IsDefaultSortColumn is true.
IsDefaultSortColumnbool
False
Gets or sets a value indicating whether this column should be sorted by default.
PlaceholderTemplateRenderFragment<PlaceholderContext>?
If specified, virtualized grids will use this template to render cells whose data has not yet been loaded.
PropertyFunc<TGridItem, bool>
Gets or sets the function to executed to determine checked/unchecked status.
SelectableFunc<TGridItem, bool>?
Gets or sets the function executed to determine if the item can be selected.
SelectAllbool?
False
Gets or sets the value indicating whether the [All] checkbox is selected.
Null is undefined.
SelectAllDisabledbool
False
Gets or sets whether the [All] checkbox is disabled (not clickable).
SelectAllTemplateRenderFragment<SelectAllTemplateArgs>?
Gets or sets the template for the [All] checkbox column template.
SelectedItemsIEnumerable<TGridItem>
Gets or sets the list of selected items.
SelectFromEntireRowbool
True
Gets or sets whether the selection of rows is restricted to the SelectColumn (false) or if the whole row can be clicked to toggled the selection (true).
Default is True.
SelectModeDataGridSelectMode
Single
Gets or sets the selection mode (Single, SingleSticky or Multiple).
Sortablebool?
Gets or sets a value indicating whether the data should be sortable by this column.

The default value may vary according to the column type (for example, a TemplateColumn
or PropertyColumn`2 is sortable by default if anyTemplateColumn.SortBy
or PropertyColumn`2.SortBy parameter is specified).
SortByIGridSort<TGridItem>?
Titlestring?
Gets or sets the title text for the column.
This is rendered automatically if ColumnBase.HeaderCellItemTemplate is not used.
TitleAllCheckedstring
All rows are selected.
Gets or sets the Icon title display as a tooltip and used with Accessibility.
The default text is 'All rows are selected.'.
TitleAllIndeterminatestring
Some rows are selected.
Gets or sets the Icon title display as a tooltip and used with Accessibility.
The default text is 'Some rows are selected.'.
TitleAllUncheckedstring
No rows are selected.
Gets or sets the Icon title display as a tooltip and used with Accessibility.
The default text is 'No rows are selected.'.
TitleCheckedstring
Row selected.
Gets or sets the Icon title display as a tooltip and used with Accessibility.
The default text is 'Row selected'.
TitleUncheckedstring
Row unselected
Gets or sets the Icon title display as a tooltip and used with Accessibility.
The default text is 'Row unselected'.
Tooltipbool
False
If true, generates a title and aria-label attribute for the cell contents
TooltipTextFunc<TGridItem, string>?
Gets or sets the function that defines the value to be used as the tooltip and aria-label in this column's cells
Widthstring?
50px
Gets or sets the width of the column.
Use either this or the FluentDataGrid GridTemplateColumns parameter but not both.
Needs to be a valid CSS width value like '100px', '10%' or '0.5fr'.

EventCallbacks

Name
Type
Description
OnSelectEventCallback<(TGridItem Item, bool Selected)>
Gets or sets the action to be executed when the row is selected or unselected.
This action is required to update you data model.
SelectAllChangedEventCallback<bool?>
Gets or sets the action to be executed when the [All] checkbox is clicked.
When this action is defined, the [All] checkbox is displayed.
This action is required to update you data model.
SelectedItemsChangedEventCallback<IEnumerable<TGridItem>>
Gets or sets a callback when list of selected items changed.

Methods

Name
Parameters
Type
Description
ClearSelectionvoid
Allows to clear the selection.
ClearSelectionAsyncTask
Allows to clear the selection.

Column menu labels and icons

For customizing/translating the labels and icons used in the column menus, the following records are available. They can be applied to a grid by setting the respective parameters to an instance of these records. If you do not want to use an icon for a menu item, supply a null value to the Icon property in a record:


        ColumnResizeLabels resizeLabels = ColumnResizeLabels.Default with
        {
            DiscreteLabel = "Abcd efg",
            ResetAriaLabel = "hij klm",
            Icon = null
        };
    

ColumnSortLabels Class

Properties

Name
Type
Default
Description
DefaultColumnSortLabels
Gets the default labels for the sort UI.
IconIcon?
Preview: 
Gets or sets the icon to show in the column menu
IconPositionStartbool
True
Gets or sets whether the icon is positioned at the start (true) or
at the end (false) of the menu item
SortMenustring
Sort
Gets or sets the text shown in the column menu
SortMenuAscendingLabelstring
Sort (ascending)
Gets or sets the text shown in the column menu when in ascending order
SortMenuDescendingLabelstring
Sort (descending)
Gets or sets the text shown in the column menu when in descending order

Methods

Name
Parameters
Type
Description
<Clone>$ColumnSortLabels

ColumnOptionsLabels Class

Properties

Name
Type
Default
Description
DefaultColumnOptionsLabels
Gets the default labels for the options UI.
IconIcon?
Preview: 
Gets or sets the icon to show in the column menu
IconPositionStartbool
True
Gets or sets whether the icon is positioned at the start (true) or
at the end (false) of the menu item
OptionsMenustring
Filter
Gets or sets the text shown in the column menu

Methods

Name
Parameters
Type
Description
<Clone>$ColumnOptionsLabels

ColumnResizeLabels Class

Properties

Name
Type
Default
Description
DefaultColumnResizeLabels
Gets the default labels for the resize UI.
DiscreteLabelstring
Column width
Gets or sets the label in the discrete mode resize UI
ExactLabelstring
Column width (in pixels)
Gets or sets the label in the exact mode resize UI
GrowAriaLabelstring?
Grow column width
Gets or sets the aria label for the grow button in the discrete resize UI
IconIcon?
Preview: 
Gets or sets the icon to show in the column menu
IconPositionStartbool
True
Gets or sets whether the icon is positioned at the start (true) or
at the end (false) of the menu item
ResetAriaLabelstring?
Reset column widths
Gets or sets the aria label for the reset button in the resize UI
ResizeMenustring
Resize
Gets or sets the text shown in the column menu
ShrinkAriaLabelstring?
Shrink column width
Gets or sets the aria label for the shrink button in the discrete resize UI
SubmitAriaLabelstring?
Set column widths
Gets or sets the aria label for the submit button in the resize UI

Methods

Name
Parameters
Type
Description
<Clone>$ColumnResizeLabels

The FluentDataGridRow and FluentDataGridCell API's are usually not used directly

FluentDataGridRow<TGridItem> Class

Parameters

Name
Type
Default
Description
ChildContentRenderFragment?
Gets or sets the content to be rendered inside the component.
ColumnsIReadOnlyList<ColumnBase<TGridItem>>
Gets the columns associated with this data grid row.
GridTemplateColumnsstring?
Gets or sets the string that gets applied to the css gridTemplateColumns attribute for the row.
ItemTGridItem?
Gets or sets the reference to the item that holds this row's values.
RowIndexint?
Gets or sets the index of this row.
When FluentDataGrid is virtualized, this value is not used.
RowTypeDataGridRowType?
Default
Gets or sets the type of row. See DataGridRowType.
VerticalAlignmentVerticalAlignment
Center

EventCallbacks

Name
Type
Description
OnCellFocusEventCallback<FluentDataGridCell<TGridItem>>

FluentDataGridCell<TGridItem> Class

Parameters

Name
Type
Default
Description
CellTypeDataGridCellType
Default
Gets or sets the cell type. See DataGridCellType.
ChildContentRenderFragment?
Gets or sets the content to be rendered inside the component.
ColumnColumnBase<TGridItem>
Gets a reference to the column that this cell belongs to.
GridColumnint
0
Gets or sets the column index of the cell.
This will be applied to the css grid-column-index value applied to the cell.
ItemTGridItem?
Gets or sets the reference to the item that holds this cell's values.

FluentPaginator Class

Parameters

Name
Type
Default
Description
Disabledbool
False
Disables the pagination buttons
PaginationTextTemplateRenderFragment?
Optionally supplies a template for rendering the pagination summary.
The following values can be included:
{your State parameter name}.CurrentPageIndex (zero-based, so +1 for the current page number)
{your State parameter name}.LastPageIndex (zero-based, so +1 for the total number of pages)
StatePaginationState
Gets or sets the associated PaginationState. This parameter is required.
SummaryTemplateRenderFragment?
Optionally supplies a template for rendering the page count summary.
The following values can be included:
{your State parameter name}.TotalItemCount (for the total number of items)

EventCallbacks

Name
Type
Description
CurrentPageIndexChangedEventCallback<int>

PaginationState Class

Properties

Name
Type
Default
Description
CurrentPageIndexint
0
Gets the current zero-based page index. To set it, call PaginationState.SetCurrentPageIndexAsync(System.Int32).
ItemsPerPageint
10
Gets or sets the number of items on each page.
To set it and update any associated FluentDataGrid, call PaginationState.SetItemsPerPageAsync(System.Int32)
LastPageIndexint?
Gets the zero-based index of the last page, if known. The value will be null until PaginationState.TotalItemCount is known.
TotalItemCountint?
Gets the total number of items across all pages, if known. The value will be null until an
associated FluentDataGrid assigns a value after loading data.

Methods

Name
Parameters
Type
Description
SetCurrentPageIndexAsyncint pageIndex
Task
Sets the current page index, and notifies any associated FluentDataGrid
to fetch and render updated data.
SetItemsPerPageAsyncint itemsPerPage
Task
Sets the items per page and notifies any associated FluentDataGrid
to fetch and render updated data.
SetTotalItemCountAsyncint totalItemCount
bool force
Task
Sets the total number of items nd makes sure the current page index stays valid.

Refreshing data programmatically

Sometimes you might know that the data source's contents will have changed. For example, the user may have saved some changes that will affect the data, or they might have changed the current query parameters. In any such case, you can call the grid's RefreshDataAsync method:


    <FluentDataGrid ... @ref="myGrid">
    ...
    </FluentDataGrid>

    @code {
    FluentDataGrid<MyDataType> myGrid;

    async Task HandleSomeEvent()
    {
    ...

    // We can force the grid to reload the current data
    await myGrid.RefreshDataAsync();
    }
    }
Grid
Table
None
Default
Sticky
Discrete
Exact
Smaller
Small
Medium
Large
Start
Center
End
Stretch
Baseline
Auto
Ascending
Descending
Start
Center
End
Stretch
Baseline
Auto
Ascending
Descending
Start
Center
End
Stretch
Baseline
Auto
Ascending
Descending
Single
SingleSticky
Multiple
Default
Header
StickyHeader
Top
Center
Bottom
Stretch
SpaceBetween
Default
ColumnHeader
RowHeader
Filled.Size20.CheckboxIndeterminate
Regular.Size16.ArrowSort
Regular.Size16.Filter
Regular.Size16.TableResizeColumn
An error has occurred. This application may no longer respond until reloaded. Reload 🗙