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
CurrentSortLabel
The current sort label.
public MudTableSortLabel<T>? CurrentSortLabel { get; protected set; }
Property Value
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
SortDirection
The current sort direction of the table.
public override SortDirection SortDirection { get; protected set; }
Property Value
SortLabels
The current list of sort labels.
public List<MudTableSortLabel<T>> SortLabels { get; set; }
Property Value
Methods
Add(MudTr, object?)
Adds a row and its related data.
public override void Add(MudTr row, object? item)
Parameters
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
MudTrThe new row to edit.
Remove(MudTr, object?)
Removes a row and its related data.
public override void Remove(MudTr row, object? item)
Parameters
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
boolWhen
true
and the label's sort direction is None, it will be changed to Ascending.
Returns
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)