Table of Contents

Class MudDataGrid<T>

Namespace
MudBlazor
Assembly
MudBlazor.dll

Represents a sortable, filterable data grid with multiselection and pagination.

[CascadingTypeParameter("T")]
public class MudDataGrid<T> : MudComponentBase, IComponent, IHandleEvent, IHandleAfterRender, IMudStateHasChanged, IDisposable

Type Parameters

T

The type of data represented by each row in this grid.

Inheritance
MudDataGrid<T>
Implements
Inherited Members
Extension Methods

Constructors

MudDataGrid()

public MudDataGrid()

Fields

RenderedColumns

The columns currently being displayed.

public readonly List<Column<T>> RenderedColumns

Field Value

List<Column<T>>

Properties

ApplyDropClassesOnDragStarted

Shows drop locations for columns even when not currently dragging a column.

[Parameter]
public bool ApplyDropClassesOnDragStarted { get; set; }

Property Value

bool

Remarks

Defaults to false.

Bordered

Shows left and right borders for each column.

[Parameter]
public bool Bordered { get; set; }

Property Value

bool

Remarks

Defaults to false.

Breakpoint

The breakpoint at which the grid switches to mobile layout.

[Parameter]
public Breakpoint Breakpoint { get; set; }

Property Value

Breakpoint

Remarks

Defaults to Xs. Supported values are None, Xs, Sm, Md, Lg and Xl.

CanCancelEdit

Shows a cancel button during inline editing when EditMode is Cell.

[Parameter]
public bool CanCancelEdit { get; set; }

Property Value

bool

Remarks

Defaults to true.

CanceledEditingItem

Occurs when editing of an item has been canceled.

[Parameter]
public EventCallback<T> CanceledEditingItem { get; set; }

Property Value

EventCallback<T>

ChildRowContent

The content shown for each cell.

[Parameter]
public RenderFragment<CellContext<T>> ChildRowContent { get; set; }

Property Value

RenderFragment<CellContext<T>>

Classname

protected string Classname { get; }

Property Value

string

CloneStrategy

The technique used to copy items for editing.

[Parameter]
public ICloneStrategy<T> CloneStrategy { get; set; }

Property Value

ICloneStrategy<T>

Remarks

During edit mode, a copy of the item is edited, in order to allow an edit to be canceled. This property controls how that copy is made.

ColGroup

The content for any column groupings.

[Parameter]
public RenderFragment ColGroup { get; set; }

Property Value

RenderFragment

Remarks

This property specifies a group of one or more columns in a table for formatting. For example:

table colgroup col span="2" style="background-color:red" col style="background-color:yellow" colgroup header body table

ColumnResizeMode

The column resizing behavior for this grid.

[Parameter]
public ResizeMode ColumnResizeMode { get; set; }

Property Value

ResizeMode

Remarks

Defaults to None. Other values include Column and Container.

Columns

Any custom content for this grid's columns.

[Parameter]
public RenderFragment Columns { get; set; }

Property Value

RenderFragment

ColumnsPanelReordering

Allows columns to be reordered via the columns panel.

[Parameter]
public bool ColumnsPanelReordering { get; set; }

Property Value

bool

Remarks

Defaults to false.

CommittedItemChanges

Occurs when the user saved changes to an item.

[Parameter]
public EventCallback<T> CommittedItemChanges { get; set; }

Property Value

EventCallback<T>

Comparer

The comparer used to determine row selection.

[Parameter]
public IEqualityComparer<T> Comparer { get; set; }

Property Value

IEqualityComparer<T>

Remarks

Defaults to null. When set, this comparer will be used to determine if a row is selected.

Culture

The culture used to format numeric and date values. Can be overridden by Culture.

[Parameter]
public CultureInfo Culture { get; set; }

Property Value

CultureInfo

Remarks

Defaults to InvariantCulture.

CurrentPage

The current page being displayed.

[Parameter]
public int CurrentPage { get; set; }

Property Value

int

Remarks

Defaults to 0. Applies when the PagerContent section contains a MudTablePager.

CurrentPageChanged

Occurs when CurrentPage has changed.

[Parameter]
public EventCallback<int> CurrentPageChanged { get; set; }

Property Value

EventCallback<int>

Dense

Uses compact padding.

[Parameter]
public bool Dense { get; set; }

Property Value

bool

Remarks

Defaults to false.

DragDropColumnReordering

Allows columns to be reordered via drag-and-drop.

[Parameter]
public bool DragDropColumnReordering { get; set; }

Property Value

bool

Remarks

Defaults to false. Can be overridden for individual columns via DragAndDropEnabled.

DragIndicatorIcon

The icon displayed when hovering over a draggable column.

[Parameter]
public string DragIndicatorIcon { get; set; }

Property Value

string

Remarks

Defaults to DragIndicator. Use the DragIndicatorSize property to control this icon's size.

DragIndicatorSize

The size of the icon displayed when hovering over a draggable column.

[Parameter]
public Size DragIndicatorSize { get; set; }

Property Value

Size

Remarks

Defaults to Small. Use the DragIndicatorIcon property to control which icon is displayed.

DropAllowedClass

The CSS class applied to columns where a dragged column can be dropped.

[Parameter]
public string DropAllowedClass { get; set; }

Property Value

string

Remarks

Defaults to drop-allowed.

DropNotAllowedClass

The CSS class applied to columns where a dragged column cannot be dropped.

[Parameter]
public string DropNotAllowedClass { get; set; }

Property Value

string

Remarks

Defaults to drop-not-allowed.

EditDialogOptions

Any options applied to the edit dialog when EditMode is Form.

[Parameter]
public DialogOptions EditDialogOptions { get; set; }

Property Value

DialogOptions

EditMode

Controls how cell values are edited.

[Parameter]
public DataGridEditMode? EditMode { get; set; }

Property Value

DataGridEditMode?

Remarks

Defaults to Cell. Only works when ReadOnly is false.

EditTrigger

The behavior which begins editing a cell when EditMode is Form.

[Parameter]
public DataGridEditTrigger? EditTrigger { get; set; }

Property Value

DataGridEditTrigger?

Remarks

Defaults to Manual.

Elevation

The size of the drop shadow.

[Parameter]
public int Elevation { get; set; }

Property Value

int

Remarks

Defaults to 1. A higher number creates a heavier drop shadow. Use a value of 0 for no shadow.

FilterCaseSensitivity

The case sensitivity setting for columns with string values.

[Parameter]
public DataGridFilterCaseSensitivity FilterCaseSensitivity { get; set; }

Property Value

DataGridFilterCaseSensitivity

Remarks

Defaults to Default.

FilterDefinitions

The filter definitions for all columns.

[Parameter]
public List<IFilterDefinition<T>> FilterDefinitions { get; set; }

Property Value

List<IFilterDefinition<T>>

Remarks

When using a FilterMode of Simple, this property is managed automatically.

FilterMode

The way that this grid filters data.

[Parameter]
public DataGridFilterMode FilterMode { get; set; }

Property Value

DataGridFilterMode

Remarks

Defaults to Simple.

FilterTemplate

The template used to display each filter.

[Parameter]
public RenderFragment<MudDataGrid<T>> FilterTemplate { get; set; }

Property Value

RenderFragment<MudDataGrid<T>>

Filterable

Allows filtering of data in this grid.

[Parameter]
public bool Filterable { get; set; }

Property Value

bool

Remarks

Defaults to false. Can be overridden for individual columns via Filterable.

FilteredItems

The items which remain after applying filters.

public IEnumerable<T> FilteredItems { get; }

Property Value

IEnumerable<T>

FixedFooter

Fixes the footer in place even as the grid is scrolled.

[Parameter]
public bool FixedFooter { get; set; }

Property Value

bool

Remarks

Set the Height property to make this grid scrollable.

FixedHeader

Fixes the header in place even as the grid is scrolled.

[Parameter]
public bool FixedHeader { get; set; }

Property Value

bool

Remarks

Set the Height property to make this grid scrollable.

FootClassname

protected string FootClassname { get; }

Property Value

string

FooterClass

The CSS classes applied to the grid footer.

[Parameter]
public string FooterClass { get; set; }

Property Value

string

Remarks

These classes are applied to the tfoot tag of the grid. Multiple classes must be separated by spaces.

FormFieldChanged

Occurs when a field changes in the edit dialog.

[Parameter]
public EventCallback<FormFieldChangedEventArgs> FormFieldChanged { get; set; }

Property Value

EventCallback<FormFieldChangedEventArgs>

Remarks

This event only occurs when EditMode is Form.

GroupClass

The CSS classes applied to column groups.

[Parameter]
public string GroupClass { get; set; }

Property Value

string

Remarks

Applies when Groupable is true. Multiple classes must be separated by spaces.

GroupClassFunc

The function which determines CSS classes for column groups.

[Parameter]
public Func<GroupDefinition<T>, string> GroupClassFunc { get; set; }

Property Value

Func<GroupDefinition<T>, string>

Remarks

Applies when Groupable is true.

GroupExpanded

Expands grouped columns by default.

[Parameter]
public bool GroupExpanded { get; set; }

Property Value

bool

Remarks

Defaults to false. Applies when Groupable is true.

GroupStyle

The CSS styles applied to column groups.

[Parameter]
public string GroupStyle { get; set; }

Property Value

string

Remarks

Applies when Groupable is true.

GroupStyleFunc

The function which determines CSS styles for column groups.

[Parameter]
public Func<GroupDefinition<T>, string> GroupStyleFunc { get; set; }

Property Value

Func<GroupDefinition<T>, string>

Remarks

Applies when Groupable is true.

Groupable

Allows grouping of columns in this grid.

[Parameter]
public bool Groupable { get; set; }

Property Value

bool

Remarks

Defaults to false. When true, columns can be used to group sets of items. Can be overridden for individual columns via Groupable.

HasPager

Indicates if a MudDataGridPager<T> is present.

public bool HasPager { get; set; }

Property Value

bool

HeadClassname

protected string HeadClassname { get; }

Property Value

string

Header

Any custom content for this grid's header.

[Parameter]
public RenderFragment Header { get; set; }

Property Value

RenderFragment

HeaderClass

The CSS classes applied to the grid header.

[Parameter]
public string HeaderClass { get; set; }

Property Value

string

Remarks

These classes are applied to the thead tag of the grid. Multiple classes must be separated by spaces.

HeaderFooterStyle

protected string HeaderFooterStyle { get; }

Property Value

string

Height

The height of this grid.

[Parameter]
public string Height { get; set; }

Property Value

string

Remarks

Defaults to null. Values such as 30% and 500px are allowed. When null, the grid will try to grow in height. Must be set when Virtualize is true.

Hideable

Allows columns to be hidden.

[Parameter]
public bool Hideable { get; set; }

Property Value

bool

Remarks

Defaults to false. Can be overridden for individual columns via Hideable.

HorizontalScrollbar

Shows a horizontal scrollbar.

[Parameter]
public bool HorizontalScrollbar { get; set; }

Property Value

bool

Remarks

Defaults to false.

Hover

Highlights rows when hovering over them.

[Parameter]
public bool Hover { get; set; }

Property Value

bool

Remarks

Defaults to false.

ItemSize

The height of each row, in pixels, when Virtualize is true.

[Parameter]
public float ItemSize { get; set; }

Property Value

float

Items

The data for this grid when ServerData is not set.

[Parameter]
public IEnumerable<T> Items { get; set; }

Property Value

IEnumerable<T>

Remarks

One row will be displayed per item. Use the ServerData function instead of this property to get data on demand.

Loading

Shows a loading animation while querying data.

[Parameter]
public bool Loading { get; set; }

Property Value

bool

Remarks

Defaults to false. This property is true while the ServerData function is executing.

LoadingContent

The content shown while Loading is true.

[Parameter]
public RenderFragment LoadingContent { get; set; }

Property Value

RenderFragment

LoadingProgressColor

The color of the loading progress indicator while Loading is true.

[Parameter]
public Color LoadingProgressColor { get; set; }

Property Value

Color

Remarks

Defaults to Info. Theme colors are supported.

MultiSelection

Allows selection of more than one row.

[Parameter]
public bool MultiSelection { get; set; }

Property Value

bool

Remarks

Defaults to false.

NoRecordsContent

The content shown when there are no rows to display.

[Parameter]
public RenderFragment NoRecordsContent { get; set; }

Property Value

RenderFragment

Outlined

Shows an outline around this grid.

[Parameter]
public bool Outlined { get; set; }

Property Value

bool

Remarks

Defaults to false.

OverscanCount

The number of additional items rendered outside the visible region when Virtualize is true.

[Parameter]
public int OverscanCount { get; set; }

Property Value

int

Remarks

Defaults to 3. This value can reduce the amount of rendering during scrolling, but higher values can affect performance.

PagerContent

The content shown for pagination.

[Parameter]
public RenderFragment PagerContent { get; set; }

Property Value

RenderFragment

Remarks

A MudTablePager is typically added here to break up rows into multiple pages.

PagerStateHasChangedEvent

Occurs when the pager state has changed.

public Action PagerStateHasChangedEvent { get; set; }

Property Value

Action

QuickFilter

The function which determines visibility of each item in this grid.

[Parameter]
public Func<T, bool> QuickFilter { get; set; }

Property Value

Func<T, bool>

Remarks

Defaults to null. This function is typically used to implement a custom search.

ReadOnly

Prevents values from being edited.

[Parameter]
public bool ReadOnly { get; set; }

Property Value

bool

Remarks

Defaults to true. When false, the edit behavior is controlled via EditMode.

RowClass

The CSS class applied to each row.

[Parameter]
public string RowClass { get; set; }

Property Value

string

Remarks

Multiple classes must be separated by spaces. Note that some CSS settings are overridden by other styles, such as those from MudTd.

RowClassFunc

The function which calculates CSS classes for each row.

[Parameter]
public Func<T, int, string> RowClassFunc { get; set; }

Property Value

Func<T, int, string>

Remarks

The function passes the current item and row index as parameters.

RowClick

Occurs when a row has been clicked.

[Parameter]
public EventCallback<DataGridRowClickEventArgs<T>> RowClick { get; set; }

Property Value

EventCallback<DataGridRowClickEventArgs<T>>

RowContextMenuClick

Occurs when a row has been right-clicked.

[Parameter]
public EventCallback<DataGridRowClickEventArgs<T>> RowContextMenuClick { get; set; }

Property Value

EventCallback<DataGridRowClickEventArgs<T>>

RowLoadingContent

A RenderFragment that will be used as a placeholder when the Virtualize component is asynchronously loading data. This placeholder is displayed for each item in the data source that is yet to be loaded. Useful for presenting a loading indicator in a data grid row while the actual data is being fetched from the server.

[Parameter]
public RenderFragment RowLoadingContent { get; set; }

Property Value

RenderFragment

RowStyle

The CSS styles applied to each row.

[Parameter]
public string RowStyle { get; set; }

Property Value

string

Remarks

Some CSS settings are overridden by other styles, such as those from MudTd.

RowStyleFunc

The function which calculates CSS styles for each row.

[Parameter]
public Func<T, int, string> RowStyleFunc { get; set; }

Property Value

Func<T, int, string>

Remarks

The function passes the current item and row index as parameters.

RowsPerPage

The number of rows displayed for each page.

[Parameter]
public int RowsPerPage { get; set; }

Property Value

int

Remarks

Defaults to 10. Applies when the PagerContent section contains a MudTablePager. When this property changes, the RowsPerPageChanged event occurs.

RowsPerPageChanged

Occurs when the RowsPerPage has changed.

[Parameter]
public EventCallback<int> RowsPerPageChanged { get; set; }

Property Value

EventCallback<int>

SelectOnRowClick

Toggles the row checkbox when the row is clicked.

[Parameter]
public bool SelectOnRowClick { get; set; }

Property Value

bool

Remarks

Defaults to true.

SelectedItem

The currently selected row when MultiSelection is false.

[Parameter]
public T SelectedItem { get; set; }

Property Value

T

Remarks

This property can be bound (@bind-SelectedItem) to initially select a row. Use SelectedItems when MultiSelection is true.

SelectedItemChanged

Occurs when the SelectedItem has changed.

[Parameter]
public EventCallback<T> SelectedItemChanged { get; set; }

Property Value

EventCallback<T>

Remarks

This typically occurs when a row has been clicked.

SelectedItems

The currently selected rows when MultiSelection is true.

[Parameter]
public HashSet<T> SelectedItems { get; set; }

Property Value

HashSet<T>

Remarks

This property can be bound (@bind-SelectedItems) to initially select rows. Use SelectedItem when MultiSelection is false.

SelectedItemsChanged

Occurs when the SelectedItems have changed.

[Parameter]
public EventCallback<HashSet<T>> SelectedItemsChanged { get; set; }

Property Value

EventCallback<HashSet<T>>

Remarks

This typically occurs when one or more rows have been clicked when MultiSelection is true.

Selection

The currently selected items.

public HashSet<T> Selection { get; set; }

Property Value

HashSet<T>

ServerData

The function which gets data for this grid.

[Parameter]
public Func<GridState<T>, Task<GridData<T>>> ServerData { get; set; }

Property Value

Func<GridState<T>, Task<GridData<T>>>

Remarks

The function accepts a GridState<T> with current sorting, filtering, and pagination parameters. Then, return a GridData<T> with a page of values, and the total (unpaginated) items set in TotalItems. When set, the Items property cannot be set.

ServerItems

The items returned by the ServerData function.

public IEnumerable<T> ServerItems { get; }

Property Value

IEnumerable<T>

ShowColumnOptions

Shows options for columns.

[Parameter]
public bool ShowColumnOptions { get; set; }

Property Value

bool

Remarks

Defaults to true. Can be overridden for individual columns via ShowColumnOptions.

ShowFilterIcons

Shows icons for each column filter.

[Parameter]
public bool ShowFilterIcons { get; set; }

Property Value

bool

Remarks

Defaults to true. Can be overridden for individual columns via ShowFilterIcon.

ShowMenuIcon

Shows the settings icon in the grid header.

[Parameter]
public bool ShowMenuIcon { get; set; }

Property Value

bool

Remarks

Defaults to false. When true, an icon will be displayed to control column visibility, collapse all columns, or expand all columns.

SortDefinitions

The sort definitions for all columns.

[Parameter]
public Dictionary<string, SortDefinition<T>> SortDefinitions { get; set; }

Property Value

Dictionary<string, SortDefinition<T>>

Remarks

When using a FilterMode of Simple, this property is managed automatically.

SortMode

Sorts data in the grid.

[Parameter]
public SortMode SortMode { get; set; }

Property Value

SortMode

Remarks

Defaults to Multiple. Can be overridden for individual columns via Sortable.

Square

Disables rounded corners.

[Parameter]
public bool Square { get; set; }

Property Value

bool

Remarks

Defaults to false. Can be overridden by Rounded

StartedEditingItem

Occurs when edit mode begins for an item.

[Parameter]
public EventCallback<T> StartedEditingItem { get; set; }

Property Value

EventCallback<T>

Remarks

If changes are committed, the CommittedItemChanges event occurs. If editing is canceled, the CanceledEditingItem occurs.

Striped

Shows alternating row styles.

[Parameter]
public bool Striped { get; set; }

Property Value

bool

Remarks

Defaults to false.

Stylename

protected string Stylename { get; }

Property Value

string

TableClass

protected string TableClass { get; }

Property Value

string

TableStyle

protected string TableStyle { get; }

Property Value

string

ToolBarContent

Any custom content to show in this grid's toolbar.

[Parameter]
public RenderFragment ToolBarContent { get; set; }

Property Value

RenderFragment

Validator

The validator which validates values in each row.

[Parameter]
public IForm Validator { get; set; }

Property Value

IForm

Remarks

Use to bind validation and touched handling to outer form.

Virtualize

Renders only visible items instead of all items.

[Parameter]
public bool Virtualize { get; set; }

Property Value

bool

Remarks

Defaults to false. Only works when Height is set. This feature can improve performance for large data sets.

VirtualizeServerData

The function which gets data for this grid.

[Parameter]
public Func<GridStateVirtualize<T>, CancellationToken, Task<GridData<T>>> VirtualizeServerData { get; set; }

Property Value

Func<GridStateVirtualize<T>, CancellationToken, Task<GridData<T>>>

Remarks

The function accepts a GridStateVirtualize<T> with current sorting, filtering, and pagination parameters. Then, return a GridData<T> with a list of values, and the total (unpaginated) items count in TotalItems. This property is used when you need to display a list without a paginator, but with loading data from the server as the scroll position changes.

numPages

protected int numPages { get; }

Property Value

int

Methods

AddFilter()

Occurs when the "Add Filter" button is pressed.

public void AddFilter()

AddFilterAsync(IFilterDefinition<T>)

Adds the specified filter to the list of filters.

public Task AddFilterAsync(IFilterDefinition<T> definition)

Parameters

definition IFilterDefinition<T>

The filter to add.

Returns

Task

BuildRenderTree(RenderTreeBuilder)

protected override void BuildRenderTree(RenderTreeBuilder __builder)

Parameters

__builder RenderTreeBuilder

CancelEditingItemAsync()

Cancels the current editing of an item.

public Task CancelEditingItemAsync()

Returns

Task

ClearFiltersAsync()

Removes all filters from all columns.

public Task ClearFiltersAsync()

Returns

Task

CollapseAllGroups()

Collapses all groups.

public void CollapseAllGroups()

Remarks

Applies when Groupable is true.

Dispose()

Releases resources used by this data grid.

public void Dispose()

Dispose(bool)

protected virtual void Dispose(bool disposing)

Parameters

disposing bool

ExpandAllGroups()

Expands all groups.

public void ExpandAllGroups()

Remarks

Applies when Groupable is true.

ExtendSortAsync(string, SortDirection, Func<T, object>, IComparer<object>)

Adds or replaces a sort behavior depending on the SortMode.

public Task ExtendSortAsync(string field, SortDirection direction, Func<T, object> sortFunc, IComparer<object> comparer = null)

Parameters

field string

The field to sort.

direction SortDirection

The direction to sort results.

sortFunc Func<T, object>

The function which sorts results.

comparer IComparer<object>

The comparer used for custom comparisons.

Returns

Task

Remarks

When the SortMode is Single, this method replaces the sort column. Otherwise, this sort is appended to any existing sort column.

GetFilteredItemsCount()

Gets the total count of filtered items in the data grid.

public int GetFilteredItemsCount()

Returns

int

The number of items remaining after applying filters. When ServerData is in use, the TotalItems value is returned.

GetItemsOfPage(int, int)

protected IEnumerable<T> GetItemsOfPage(int page, int pageSize)

Parameters

page int
pageSize int

Returns

IEnumerable<T>

GroupItems(bool)

Performs grouping of the current items.

public void GroupItems(bool noStateChange = false)

Parameters

noStateChange bool

Defaults to false. When true, calls to StateHasChanged will not occur.

Remarks

Applies when Groupable is true.

HideColumnsPanel()

Hides the columns panel.

public void HideColumnsPanel()

NavigateTo(Page)

Navigates to a page when this grid has a MudDataGridPager<T>.

public void NavigateTo(Page page)

Parameters

page Page

The page to navigate to.

OnAfterRenderAsync(bool)

protected override Task OnAfterRenderAsync(bool firstRender)

Parameters

firstRender bool

Returns

Task

OnInitialized()

protected override void OnInitialized()

OnParametersSet()

protected override void OnParametersSet()

OpenFilters()

Opens the filter panel.

public void OpenFilters()

ReloadServerData()

Reloads grid data by calling the ServerData function.

public Task ReloadServerData()

Returns

Task

RemoveSortAsync(string)

Removes a sort behavior from the list of sort behaviors.

public Task RemoveSortAsync(string field)

Parameters

field string

The name of the field to remove.

Returns

Task

SetDefaultFilterDefinition(Func<IFilterDefinition<T>>)

Specifies the default IFilterDefinition<T> to be used by AddFilter() and FilterContext.

public void SetDefaultFilterDefinition(Func<IFilterDefinition<T>> factory)

Parameters

factory Func<IFilterDefinition<T>>

The factory function to create the default filter definition.

SetDefaultFilterDefinition<TFilterDefinition>()

Specifies the default IFilterDefinition<T> to be used by AddFilter() and FilterContext.

public void SetDefaultFilterDefinition<TFilterDefinition>() where TFilterDefinition : IFilterDefinition<T>, new()

Type Parameters

TFilterDefinition

SetEditingItemAsync(T)

Starts editing for the specified item.

public Task SetEditingItemAsync(T item)

Parameters

item T

The item to edit.

Returns

Task

SetParametersAsync(ParameterView)

public override Task SetParametersAsync(ParameterView parameters)

Parameters

parameters ParameterView

Returns

Task

SetRowsPerPageAsync(int)

Sets the RowsPerPage when this grid contains a MudDataGridPager<T>.

public Task SetRowsPerPageAsync(int size)

Parameters

size int

The new page size.

Returns

Task

SetRowsPerPageAsync(int, bool)

Sets the RowsPerPage when this grid contains a MudDataGridPager<T>.

public Task SetRowsPerPageAsync(int size, bool resetPage)

Parameters

size int

The new page size.

resetPage bool

When true, resets CurrentPage to 0.

Returns

Task

SetSelectedItemAsync(T)

Set the currently selected item in the data grid.

public Task SetSelectedItemAsync(T item)

Parameters

item T

The item to select.

Returns

Task

Remarks

When MultiSelection is true and SelectOnRowClick is true, the SelectedItems are updated. The SelectedItem is also updated.

SetSortAsync(string, SortDirection, Func<T, object>, IComparer<object>)

Replaces the sorting behavior for a field.

public Task SetSortAsync(string field, SortDirection direction, Func<T, object> sortFunc, IComparer<object> comparer = null)

Parameters

field string

The field to sort.

direction SortDirection

The direction to sort results.

sortFunc Func<T, object>

The function which sorts results.

comparer IComparer<object>

The comparer used for custom comparisons.

Returns

Task

ShowColumnsPanel()

Shows a panel that lets you show, hide, filter, group, sort and re-arrange columns.

public void ShowColumnsPanel()

ToggleFiltersMenu()

Opens or closes the filter panel.

public void ToggleFiltersMenu()