Table of Contents

Class ColumnFilter

Namespace
TwBlazor.Models
Assembly
TwBlazor.dll

A column's filter: one condition, or two combined with Logic. It holds only plain values, so it can be saved, such as with the rest of a TwDataTableState, passed to a ItemsProvider, or kept on a SheetTable.

[ExcludeFromCodeCoverage]
public sealed class ColumnFilter
Inheritance
ColumnFilter
Inherited Members

Constructors

ColumnFilter()

public ColumnFilter()

Properties

First

Gets or sets the first condition.

public FilterCondition First { get; set; }

Property Value

FilterCondition

IsActive

Gets whether either condition takes part in filtering.

public bool IsActive { get; }

Property Value

bool

Logic

Gets or sets how the two conditions combine. Defaults to And.

public FilterLogic Logic { get; set; }

Property Value

FilterLogic

Second

Gets or sets the second condition, or null for one condition only.

public FilterCondition? Second { get; set; }

Property Value

FilterCondition

Methods

Clone()

Creates a deep copy of the filter.

public ColumnFilter Clone()

Returns

ColumnFilter

A new ColumnFilter with the same values.

Matches(object?, FilterType)

Gets whether a value passes the filter, with the same rules as the filters of TwDataTable<TItem> and TwSpreadsheet. Conditions that are not active are ignored, so an empty filter passes everything.

public bool Matches(object? value, FilterType type = FilterType.Text)

Parameters

value object

The value, such as a number, a date, true or text.

type FilterType

The kind of values being filtered, which decides how they are compared. Defaults to Text.

Returns

bool

true when the value passes.