Filtering component implementations
Values
The TyneFilterValue component provides a simple implementation for filter values. Selection values should use TyneFilterSelectSingleValue or TyneFilterSelectMultiValue.
If creating your own value type, you need to imlement IFilterValue<TRequest, TValue>. Alternatively, TyneFilterValueBase does a lot of the heavy lifting of values and can be extended.
Example usage:
<TyneFilterValue TRequest="SearchParts.Request" TValue="string" For="m => m.Name" PersistAs="PartName" />
<TyneFilterSelectSingleValue TRequest="SearchParts.Request" TValue="PartSize?" For="m => m.Size" PersistAs="*">
<Values>
<TyneFilterSelectItem TValue="PartSize?" Value="null">Any</TyneFilterSelectItem>
<TyneFilterSelectItem TValue="PartSize?" Value="PartSize.Small">Small</TyneFilterSelectItem>
<TyneFilterSelectItem TValue="PartSize?" Value="PartSize.Medium">Medium</TyneFilterSelectItem>
<TyneFilterSelectItem TValue="PartSize?" Value="PartSize.Large">Large</TyneFilterSelectItem>
<TyneFilterSelectItem TValue="PartSize?" Value="PartSize.ExtraLarge">Xl</TyneFilterSelectItem>
</Values>
</TyneFilterSelectSingleValue>
<TyneFilterValue TRequest="SearchParts.Request" TValue="DateTime?" For="m => m.CreatedAtMin" />
<TyneFilterValue TRequest="SearchParts.Request" TValue="DateTime?" For="m => m.CreatedAtMax" />
See the values namespace for more value implementations.
Controllers
Controllers vary more than values as each is specialised for a certain use case.
If creating your own controller type, you need to implement IFilterController<TValue>. Alternatively, TyneFilterControllerBase does a lot of the heavy lifting of controllers which only attach to one value.
Below is a list of some of the controllers which Tyne provides. See the controllers namespace for more implementations.
Controller | Usage |
---|---|
TyneStringFilterController |
Provides a simple text input box for use with string values |
TyneCustomFilterController |
Takes a RenderFragment<T> whose context references the value |
TyneCustomMinMaxFilterController |
Similar to TyneCustomFilterController , but for a min/max value |
TyneDateRangeFilterController |
Provides a date range picker for min/max DateTime s |
*TyneSingleSelectBoxFilterController |
Provides a dropdown selection box for single select values |
*TyneSingleSelectRadioFilterController |
Provides radio buttons for single select values |
*TyneMultiSelectBoxFilterController |
Provides a dropdown selection box for multi select values |
*TyneMultiSelectCheckboxFilterController |
Provides checkboxes for multi select values |
*Note that select controllers require the attached value to implement IFilterSelectValue<TValue>
.
See the tables page for more information about controllers provided for use in table contexts.