MudDataGrid<T> API

Pages
Properties
Name Type Default Description
Misc
Bordered
bool
False If true, table's cells will have left/right borders.
Breakpoint
Breakpoint
Breakpoint.Xs At what breakpoint the table should switch to mobile layout. Takes None, Xs, Sm, Md, Lg and Xl the default behavior is breaking on Xs.
CanCancelEdit
bool
True Define if Cancel button is present or not for inline editing.
ChildRowContent
RenderFragment<T>
null Row Child content of the component.
ColGroup
RenderFragment
null Specifies a group of one or more columns in a table for formatting. Ex: table colgroup col span="2" style="background-color:red" col style="background-color:yellow" colgroup header body table
Columns
RenderFragment
null The Columns that make up the data grid. Add Column components to this RenderFragment.
CurrentPage
int
0 The page index of the currently displayed page (Zero based). Usually called by MudTablePager. Note: requires a MudTablePager in PagerContent.
Dense
bool
False Set true for rows with a narrow height
EditDialogOptions
DialogOptions
null Fine tune the edit dialog.
EditMode
DataGridEditMode?
null When the grid is not read only, you can specify what type of editing mode to use.
EditTrigger
DataGridEditTrigger?
DataGridEditTrigger.Manual Allows you to specify the action that will trigger an edit when the EditMode is Form.
Elevation
int
1 The higher the number, the heavier the drop-shadow. 0 for no shadow.
Filterable
bool
False Controls whether data in the DataGrid can be filtered. This is overridable by each column.
FilterDefinitions
List<FilterDefinition<T>>
The list of FilterDefinitions that have been added to the data grid. FilterDefinitions are managed by the data grid automatically when using the built in filter UI. You can also programmatically manage these definitions through this collection.
FixedFooter
bool
False When true, the footer will be visible is not scrolled to the bottom. Note: set Height to make the table scrollable.
FixedHeader
bool
False When true, the header will stay in place when the table is scrolled. Note: set Height to make the table scrollable.
FooterClass
string
null Add a class to the tfoot tag
Groupable
bool
False Determines whether grouping of columns is allowed in the data grid.
GroupClass
string
null CSS class for the groups.
GroupExpanded
bool
False If set, a grouped column will be expanded by default.
GroupStyle
string
null CSS styles for the groups.
Header
RenderFragment
null Allows adding a custom header beyond that specified in the Column component. Add HeaderCell components to add a custom header.
HeaderClass
string
null Add a class to the thead tag
Height
string
null Setting a height will allow to scroll the table. If not set, it will try to grow in height. You can set this to any CSS value that the attribute 'height' accepts, i.e. 500px.
Hideable
bool
False Controls whether columns in the DataGrid can be hidden. This is overridable by each column.
HorizontalScrollbar
bool
False Defines if the table has a horizontal scrollbar.
Hover
bool
False Set true to see rows hover on mouse-over.
Items
IEnumerable<T>
null The data to display in the table. MudTable will render one row per item
Loading
bool
False Show a loading animation, if true.
LoadingContent
RenderFragment
null Defines the table body content the table has no rows and is loading
LoadingProgressColor
Color
Color.Info The color of the loading progress if used. It supports the theme colors.
MultiSelection
bool
False Set to true to enable selection of multiple rows.
NoRecordsContent
RenderFragment
null Defines the table body content when there are no matching records found
Outlined
bool
False If true, table will be outlined.
PagerContent
RenderFragment
null Add MudTablePager here to enable breaking the rows in to multiple pages.
QuickFilter
Func<T, bool>
null A function that returns whether or not an item should be displayed in the table. You can use this to implement your own search function.
ReadOnly
bool
True Locks Inline Edit mode, if true.
RowClass
string
null CSS class for the table rows. Note, many CSS settings are overridden by MudTd though
RowClassFunc
Func<T, int, string>
null Returns the class that will get joined with RowClass. Takes the current item and row index.
RowsPerPage
int
10 If the table has more items than this number, it will break the rows into pages of said size. Note: requires a MudTablePager in PagerContent.
RowStyle
string
null CSS styles for the table rows. Note, many CSS settings are overridden by MudTd though
RowStyleFunc
Func<T, int, string>
null Returns the class that will get joined with RowClass. Takes the current item and row index.
SelectedItem
T
null Returns the item which was last clicked on in single selection mode (that is, if MultiSelection is false)
SelectedItems
HashSet<T>
If MultiSelection is true, this returns the currently selected items. You can bind this property and the initial content of the HashSet you bind it to will cause these rows to be selected initially.
ServerData
Func<GridState<T>, Task<GridData<T>>>
null Supply an async function which (re)loads filtered, paginated and sorted data from server. Table will await this func and update based on the returned TableData. Used only with ServerData
ShowColumnOptions
bool
True Controls whether to hide or show the column options. This is overridable by each column.
Sortable
bool
False Controls whether data in the DataGrid can be sorted. This is overridable by each column.
Square
bool
False Set true to disable rounded corners
Striped
bool
False If true, striped table rows will be used.
ToolBarContent
RenderFragment
null Optional. Add any kind of toolbar to this render fragment.
Virtualize
bool
False If true, the results are displayed in a Virtualize component, allowing a boost in rendering speed.
Common
Class
string
null User class names, separated by space.
Style
string
null User styles, applied on top of the component's own classes and styles.
Tag
object
null Use Tag to attach any user data object to the component for your convenience.
UserAttributes
Dictionary<string, object>
UserAttributes carries all attributes you add to the component that don't match any of its parameters. They will be splatted onto the underlying HTML tag.
EventCallbacks
Name Type Description
CancelledEditingItem EventCallback<T> Callback is called when the process of editing an item has been cancelled. Returns the item which was previously in edit mode.
CommittedItemChanges EventCallback<T> Callback is called when the changes to an item are committed. Returns the item whose changes were committed.
RowClick EventCallback<DataGridRowClickEventArgs<T>> Callback is called whenever a row is clicked.
SelectedItemChanged EventCallback<T> Callback is called when a row has been clicked and returns the selected item.
SelectedItemsChanged EventCallback<HashSet<T>> Callback is called whenever items are selected or deselected in multi selection mode.
StartedEditingItem EventCallback<T> Callback is called when an item has begun to be edited. Returns the item being edited.
Methods
Name Parameters Return Description
Task CancelEditingItemAsync()
Task
Cancel editing an item.
CollapseAllGroups()
ExpandAllGroups()
int GetFilteredItemsCount()
int
Gets the total count of filtered items in the data grid.
GroupItems()
HideColumnsPanel()
NavigateTo(Page page)
Page page
Navigates to a specific page when the data grid has an attached data pager.
OpenFilters() Opens the filter panel.
Task ReloadServerData()
Task
Call this to reload the server-filtered, -sorted and -paginated items
Task SetEditingItemAsync(T item)
T item
Task
Set an item to be edited.
Task SetRowsPerPageAsync(int size)
int size
Task
Sets the rows displayed per page when the data grid has an attached data pager.
Task SetSelectedItemAsync(T item)
T item
Task
Set the currently selected item in the data grid.
Task SetSortAsync(SortDirection direction, Func<T,object> sortBy, string field)
SortDirection direction
Func<T, object> sortBy
string field
Task
Sets the sort on the data grid.
ShowColumnsPanel()
ToggleFiltersMenu() Opens or closes the filter panel.
An unhandled error has occurred. Reload 🗙