Table of Contents

Class MudTableSortLabel<T>

Namespace
MudBlazor
Assembly
MudBlazor.dll

A clickable column which toggles the sort column and direction for a MudTable<T>.

public class MudTableSortLabel<T> : MudComponentBase, IComponent, IHandleEvent, IHandleAfterRender, IMudStateHasChanged, IDisposable

Type Parameters

T

The type of item displayed in the table.

Inheritance
MudTableSortLabel<T>
Implements
Inherited Members
Extension Methods

Constructors

MudTableSortLabel()

public MudTableSortLabel()

Properties

AppendIcon

Displays the icon before the label text.

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

Property Value

bool

Remarks

Defaults to false.

ChildContent

The content within this sort label.

[Parameter]
public RenderFragment? ChildContent { get; set; }

Property Value

RenderFragment

Classname

protected string Classname { get; }

Property Value

string

Context

The current state of the MudTable<T> containing this sort label.

public TableContext<T>? Context { get; }

Property Value

TableContext<T>

Enabled

Allows sorting by this column.

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

Property Value

bool

Remarks

Defaults to true.

InitialDirection

The sort direction when the MudTable<T> is first displayed.

[Parameter]
public SortDirection InitialDirection { get; set; }

Property Value

SortDirection

Remarks

Defaults to None. When using multiple sort labels, the table will sort by the first sort label with a value other than None.

SortBy

The custom function for sorting rows for this sort label.

[Parameter]
public Func<T, object>? SortBy { get; set; }

Property Value

Func<T, object>

Remarks

Defaults to null. When using ServerData, this function is not necessary.

SortDirection

The current sort direction of this column.

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

Property Value

SortDirection

SortDirectionChanged

Occurs when SortDirection has changed.

[Parameter]
public EventCallback<SortDirection> SortDirectionChanged { get; set; }

Property Value

EventCallback<SortDirection>

SortIcon

The icon for the sort button.

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

Property Value

string

Remarks

Defaults to ArrowUpward.

SortLabel

The text for this sort label.

[Parameter]
public string? SortLabel { get; set; }

Property Value

string

Table

The MudTable<T> containing this sort label.

public MudTableBase? Table { get; }

Property Value

MudTableBase

TableContext

The current state of the MudTable<T> containing this sort label.

[CascadingParameter]
public TableContext? TableContext { get; set; }

Property Value

TableContext

Methods

BuildRenderTree(RenderTreeBuilder)

protected override void BuildRenderTree(RenderTreeBuilder __builder)

Parameters

__builder RenderTreeBuilder

Dispose()

Releases resources used by this sort label.

public void Dispose()

OnInitialized()

protected override void OnInitialized()

ToggleSortDirection()

Toggles the sort direction.

public Task ToggleSortDirection()

Returns

Task

Remarks

When AllowUnsorted is true, the sort direction will cycle from None to Ascending to Descending. Otherwise, the sort direction will toggle between Ascending and Descending.