Class TwColumnFilterEditor
- Namespace
- TwBlazor.Components
- Assembly
- TwBlazor.dll
Edits a ColumnFilter: two conditions, each a comparison and the value to compare with, joined by And or Or. TwDataTable<TItem> and TwSpreadsheet show it in their filters, each with its own buttons to apply or clear the filter.
public class TwColumnFilterEditor : TwBlazorComponentBase, IComponent, IHandleEvent, IHandleAfterRender, ITwComponent
- Inheritance
-
TwColumnFilterEditor
- Implements
- Inherited Members
Remarks
The filter is edited in place, so pass a copy and keep it only when the filter is applied. Use it to build your own filter UI around the same conditions, such as in a dialog or a side panel, and test values against the filter with your own code or an ItemsProvider.
Constructors
TwColumnFilterEditor()
public TwColumnFilterEditor()
Properties
Choices
Gets or sets the values offered for Boolean and Enum, each a value and the text shown for it. null offers Yes and No for true or false values.
[Parameter]
public IReadOnlyList<KeyValuePair<string, string>>? Choices { get; set; }
Property Value
FieldIdPrefix
Gets or sets what the ids of the fields start with, such as {prefix}-first-value. Defaults to
Id.
[Parameter]
public string? FieldIdPrefix { get; set; }
Property Value
Filter
Gets or sets the filter to edit. A missing second condition is added, starting with the first comparison offered.
[Parameter]
public ColumnFilter Filter { get; set; }
Property Value
OnChange
Gets or sets the callback invoked after any part of the filter changes.
[Parameter]
public EventCallback OnChange { get; set; }
Property Value
Operators
[Parameter]
public IReadOnlyList<FilterOperator>? Operators { get; set; }
Property Value
Type
Gets or sets the kind of values the column holds, which decides the comparisons offered and the field the value is typed into. Auto is treated as text.
[Parameter]
public FilterType Type { get; set; }
Property Value
Methods
BuildRenderTree(RenderTreeBuilder)
Renders the component to the supplied RenderTreeBuilder.
protected override void BuildRenderTree(RenderTreeBuilder __builder)
Parameters
__builderRenderTreeBuilder
OnParametersSet()
Invoked when the component's parameters have been set. Ensures that the component has a unique identifier by generating one if none is provided.
protected override void OnParametersSet()
Remarks
If the component's identifier is not set, a unique ID is generated based on the component's type name (with a 'Tw' prefix removed if present) and a GUID. This helps ensure that each component instance can be uniquely identified, which is useful for scenarios such as associating labels with form elements or targeting elements in client-side scripts.