Table of Contents

Class TableContext<T>

Namespace
MudBlazor
Assembly
MudBlazor.dll

The current state of a MudTable<T>.

public class TableContext<T> : TableContext

Type Parameters

T
Inheritance
TableContext<T>
Inherited Members
Extension Methods

Remarks

Typically used to share functionality across a table's related components.

Constructors

TableContext()

public TableContext()

Properties

Comparer

The comparer used to determine selected rows.

public IEqualityComparer<T>? Comparer { get; set; }

Property Value

IEqualityComparer<T>

CurrentSortLabel

The current sort label.

public MudTableSortLabel<T>? CurrentSortLabel { get; protected set; }

Property Value

MudTableSortLabel<T>

GroupRows

The current grouping rows.

public List<MudTableGroupRow<T>> GroupRows { get; set; }

Property Value

List<MudTableGroupRow<T>>

Rows

The currently visible rows.

public Dictionary<T, MudTr> Rows { get; set; }

Property Value

Dictionary<T, MudTr>

Selection

The currently selected items.

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

Property Value

HashSet<T>

SortBy

The function which sorts data rows.

public Func<T, object>? SortBy { get; protected set; }

Property Value

Func<T, object>

SortDirection

The current sort direction of the table.

public override SortDirection SortDirection { get; protected set; }

Property Value

SortDirection

SortLabels

The current list of sort labels.

public List<MudTableSortLabel<T>> SortLabels { get; set; }

Property Value

List<MudTableSortLabel<T>>

Methods

Add(MudTr, object?)

Adds a row and its related data.

public override void Add(MudTr row, object? item)

Parameters

row MudTr

The row to add.

item object

The data associated with the row.

InitializeSorting()

Sets the initial sort direction when the table is initialized.

public override void InitializeSorting()

ManagePreviousEditedRow(MudTr)

Notifies any editing row that a new row has been selected.

public override void ManagePreviousEditedRow(MudTr row)

Parameters

row MudTr

The new row to edit.

Remove(MudTr, object?)

Removes a row and its related data.

public override void Remove(MudTr row, object? item)

Parameters

row MudTr

The row to remove.

item object

The data associated with the row.

SetSortFunc(MudTableSortLabel<T>, bool)

Updates the SortDirection and SortBy when the current sort has changed.

public Task SetSortFunc(MudTableSortLabel<T> label, bool overrideDirectionNone = false)

Parameters

label MudTableSortLabel<T>

The new sort label to sort by.

overrideDirectionNone bool

When true and the label's sort direction is None, it will be changed to Ascending.

Returns

Task

Sort(IEnumerable<T>?)

Gets the items sorted using the SortBy function.

public IEnumerable<T>? Sort(IEnumerable<T>? items)

Parameters

items IEnumerable<T>

The items to sort.

Returns

IEnumerable<T>

The sorted items.

UpdateRowCheckBoxes(bool, bool)

Refreshes the state of checkboxes in the table.

public override void UpdateRowCheckBoxes(bool updateGroups = true, bool updateHeaderFooter = true)

Parameters

updateGroups bool

When true, checkboxes in all groups will be refreshed.

updateHeaderFooter bool

When true, checkboxes in all headers and footers will be refreshed.