Table of Contents

Class TwDataTableState

Namespace
TwBlazor.Components
Assembly
TwBlazor.dll

A snapshot of everything a person can change about a TwDataTable<TItem>: the sort, the search, the page, the page size, the columns and their filters, and the grouping. Save it anywhere (a database, the URL, browser storage) and hand it back through State or SetStateAsync(TwDataTableState) to restore the table.

public sealed class TwDataTableState
Inheritance
TwDataTableState
Inherited Members

Remarks

The snapshot only holds plain values, so it serializes to JSON as it is. Columns are matched by Name: a saved column that no longer exists is ignored, and a new column that the snapshot does not mention is added at the end with its default settings.

Constructors

TwDataTableState()

public TwDataTableState()

Properties

CollapsedGroups

Gets or sets the labels of the groups that are collapsed. Every other group is expanded.

public List<string> CollapsedGroups { get; set; }

Property Value

List<string>

Columns

Gets or sets the columns in display order, with whether each is shown, how wide it is and its filter.

public List<TwDataTableColumnState> Columns { get; set; }

Property Value

List<TwDataTableColumnState>

GroupBy

Gets or sets the Name of the column the rows are grouped by, or null when they are not grouped.

public string? GroupBy { get; set; }

Property Value

string

Page

Gets or sets the one based page number. Defaults to 1.

public int Page { get; set; }

Property Value

int

RowsPerPage

Gets or sets the number of rows on a page, or null to use RowsPerPage.

public int? RowsPerPage { get; set; }

Property Value

int?

SearchQuery

Gets or sets the text in the search field, or null when nothing is searched for.

public string? SearchQuery { get; set; }

Property Value

string

SortColumn

Gets or sets the Name of the sorted column, or null when the rows are in their original order.

public string? SortColumn { get; set; }

Property Value

string

SortDirection

Gets or sets the direction of the sort. Ignored when SortColumn is null.

public SortDirection SortDirection { get; set; }

Property Value

SortDirection

Methods

Clone()

Creates a deep copy of this snapshot, so changing the copy never changes the table.

public TwDataTableState Clone()

Returns

TwDataTableState

A new TwDataTableState with the same values.