MudTable<T> API

Pages
Properties
Name Type Default Description
Data
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.
NoRecordsContent
RenderFragment
null Defines the table body content when there are no matching records found
ServerData
Func<TableState, CancellationToken, Task<TableData<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 MudTable will automatically control loading animation visibility if ServerData is set. See MudTableBase.Loading. Forward the provided cancellation token to methods which support it.
TotalItems
int
0 Number of items. Used only with ServerData="true"
Behavior
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.
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<T>
Defines how a table column looks like. Columns components should inherit from MudBaseColumn
Comparer
IEqualityComparer<T>
null The Comparer to use for comparing selected items internally.
HorizontalScrollbar
bool
False Defines if the table has a horizontal scrollbar.
ItemSize
float
50 Gets the size of each item in pixels. Defaults to 50px.
OverscanCount
int
3 Gets or sets a value that determines how many additional items will be rendered before and after the visible region. This help to reduce the frequency of rendering during scrolling. However, higher values mean that more elements will be present in the page.
QuickColumns
string
null Comma separated list of columns to show if there is no templates defined
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.
Header
CustomHeader
bool
False Specify if the header has multiple rows. In that case, you need to provide the MudTHeadRow tags.
FixedHeader
bool
False When true, the header will stay in place when the table is scrolled. Note: set Height to make the table scrollable.
HeaderClass
string
null Add a class to the thead tag
HeaderContent
RenderFragment
null Add MudTh cells here to define the table header. If MudTableBase.CustomHeader is set, add one or more MudTHeadRow instead.
Rows
ChildRowContent
RenderFragment<T>
null Row Child content of the component.
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.
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 style that will get joined with RowStyle. Takes the current item and row index.
RowTemplate
RenderFragment<T>
null Defines how a table row looks like. Use MudTd to define the table cells and their content.
SelectOnRowClick
bool
True When true, a row-click also toggles the checkbox state.
Footer
CustomFooter
bool
False Specify if the footer has multiple rows. In that case, you need to provide the MudTFootRow tags.
FixedFooter
bool
False When true, the footer will be visible is not scrolled to the bottom. Note: set Height to make the table scrollable.
FooterClass
string
null Add a class to the tfoot tag
FooterContent
RenderFragment
null Add MudTd cells here to define the table footer. IfMudTableBase.CustomFooter is set, add one or more MudTFootRow instead.
Filtering
Filter
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.
Grouping
GroupBy
TableGroupDefinition<T>
null Defines data grouping parameters. It can has N hierarchical levels
GroupFooterClass
string
null Defines custom CSS classes for using on Group Footer's MudTr.
GroupFooterStyle
string
null Defines custom styles for using on Group Footer's MudTr.
GroupFooterTemplate
RenderFragment<TableGroupData<object, T>>
null Defines how a table grouping row footer looks like. It works only when GroupBy is not null. Use MudTd to define the table cells and their content.
GroupHeaderClass
string
null Defines custom CSS classes for using on Group Header's MudTr.
GroupHeaderStyle
string
null Defines custom styles for using on Group Header's MudTr.
GroupHeaderTemplate
RenderFragment<TableGroupData<object, T>>
null Defines how a table grouping row header looks like. It works only when GroupBy is not null. Use MudTd to define the table cells and their content.
Sorting
AllowUnsorted
bool
True If true allows table to be in an unsorted state through column clicks (i.e. first click sorts "Ascending", second "Descending", third "None"). If false only "Ascending" and "Descending" states are allowed (i.e. there always should be a column to sort).
SortLabel
string
null If table is in smalldevice mode and uses any kind of sorting the text applied here will be the sort selects label.
Pagination
CurrentPage
int
0 The page index of the currently displayed page (Zero based). Usually called by MudTablePager. Note: requires a MudTablePager in PagerContent.
PagerContent
RenderFragment
null Add MudTablePager here to enable breaking the rows in to multiple pages.
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.
Selecting
MultiSelection
bool
False Set to true to enable selection of multiple rows with check boxes.
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.
Editing
ApplyButtonPosition
TableApplyButtonPosition
TableApplyButtonPosition.End Set the positon of the CommitEdit and CancelEdit button, if MudTableBase.IsEditable IsEditable is true. Defaults to the end of the row
CanCancelEdit
bool
False Define if Cancel button is present or not for inline editing.
CancelEditIcon
string
Sets the Icon of the CancelEdit Button.
CancelEditTooltip
string
null Tooltip for the CancelEdit Button.
CommitEditIcon
string
Sets the Icon of the CommitEdit Button.
CommitEditTooltip
string
null Tooltip for the CommitEdit Button.
EditButtonContent
RenderFragment<EditButtonContext>
null Defines the edit button that will be rendered when EditTrigger.EditButton
EditButtonPosition
TableEditButtonPosition
TableEditButtonPosition.End Set the positon of the StartEdit button, if MudTableBase.IsEditable IsEditable is true. Defaults to the end of the row
EditTrigger
TableEditTrigger
TableEditTrigger.RowClick Defines how a table row edit will be triggered
IsEditRowSwitchingBlocked
bool
False When editing a row and this is true, the editing row must be saved/canceled before a new row will be selected.
ReadOnly
bool
False Locks Inline Edit mode, if true.
RowEditCancel
Action<object>
null The method is called when the edition of the item has been canceled in inline editing.
RowEditCommit
Action<object>
null The method is called when the edition of the item has been committed in inline editing.
RowEditingTemplate
RenderFragment<T>
null Defines how a table row looks like in edit mode (for selected row). Use MudTd to define the table cells and their content.
RowEditPreview
Action<object>
null The method is called before the item is modified in inline editing.
Appearance
Bordered
bool
False If true, table's cells will have left/right borders.
Dense
bool
False Set true for rows with a narrow height
Elevation
int
1 The higher the number, the heavier the drop-shadow. 0 for no shadow.
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.
Hover
bool
False Set true to see rows hover on mouse-over.
Outlined
bool
False If true, table will be outlined.
Square
bool
False Set true to disable rounded corners
Striped
bool
False If true, striped table rows will be used.
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
OnCancelEditClick EventCallback<MouseEventArgs> Button cancel edit click event.
OnCommitEditClick EventCallback<MouseEventArgs> Button commit edit click event.
OnPreviewEditClick EventCallback<object> Event is called before the item is modified in inline editing.
OnRowClick EventCallback<TableRowClickEventArgs<T>> Row click event.
OnRowMouseEnter EventCallback<TableRowHoverEventArgs<T>> Row hover start event.
OnRowMouseLeave EventCallback<TableRowHoverEventArgs<T>> Row hover stop event.
RowsPerPageChanged EventCallback<int> Rows Per Page two-way bindable parameter
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.
Methods
Name Parameters Return Description
CollapseAllGroups()
bool ContainsItem(object item)
object item
bool
Dispose() Releases resources used by this table.
ExpandAllGroups()
int GetFilteredItemsCount()
int
NavigateTo(Page page)
Page page
NavigateTo(int pageIndex)
int pageIndex : The index of the page number.
Navigate to page with specified index.
Task ReloadServerData()
Task
Call this to reload the server-filtered, -sorted and -paginated items
SetEditingItem(object item)
object item
SetRowsPerPage(int size)
int size
SetSelectedItem(object item)
object item
UpdateSelection()

Copyright © 2020-2024 MudBlazor.

Powered by .NET 8.0.8

An error has occurred. This application may no longer respond until reloaded. Reload 🗙