Table of Contents

Class TableOobEditFilter

Namespace
Htmx.Components.Table.Internal
Assembly
Htmx.Components.dll

Internal result filter that processes table edit actions to provide targeted out-of-band updates for edited table rows and related components. This filter is automatically applied to controller actions marked with TableEditActionAttribute.

public class TableOobEditFilter : OobResultFilterBase<TableEditActionAttribute>, IAsyncResultFilter, IFilterMetadata
Inheritance
TableOobEditFilter
Implements
Inherited Members
Extension Methods

Remarks

This filter performs selective out-of-band updates focusing on the specific rows that have been edited, along with the table's action list and edit state toggle. Unlike the refresh filter, this filter only updates the components that are directly affected by edit operations, providing more efficient updates. It's designed exclusively for HTMX requests and will throw an exception if used with non-HTMX requests.

Constructors

TableOobEditFilter(ITableProvider, ViewPaths)

Initializes a new instance of the TableOobEditFilter class.

public TableOobEditFilter(ITableProvider tableProvider, ViewPaths viewPaths)

Parameters

tableProvider ITableProvider

The table provider for table-related operations.

viewPaths ViewPaths

The view paths configuration for resolving table component views.

Methods

GetViewNameForNonHtmxRequest(TableEditActionAttribute, ControllerActionDescriptor)

Throws an InvalidOperationException as this filter is designed exclusively for HTMX requests. Table edit operations require HTMX's out-of-band update capabilities to update individual rows and components, which cannot be handled through traditional full page renders.

protected override Task<string?> GetViewNameForNonHtmxRequest(TableEditActionAttribute attribute, ControllerActionDescriptor cad)

Parameters

attribute TableEditActionAttribute

The TableEditActionAttribute instance.

cad ControllerActionDescriptor

The controller action descriptor.

Returns

Task<string>

This method always throws an exception.

Exceptions

InvalidOperationException

Always thrown as this filter doesn't support non-HTMX requests.

UpdateMultiSwapViewResultAsync(TableEditActionAttribute, MultiSwapViewResult, ResultExecutingContext)

Updates the MultiSwapViewResult with targeted table row and component updates. This method adds out-of-band updates for the edit state toggle, action list, and individual table rows that have been modified during the edit operation.

protected override Task UpdateMultiSwapViewResultAsync(TableEditActionAttribute attribute, MultiSwapViewResult multiSwapViewResult, ResultExecutingContext context)

Parameters

attribute TableEditActionAttribute

The TableEditActionAttribute that triggered this filter.

multiSwapViewResult MultiSwapViewResult

The MultiSwapViewResult to update with table component content.

context ResultExecutingContext

The result executing context.

Returns

Task

A completed task as this operation is synchronous.

Exceptions

InvalidOperationException

Thrown when the MultiSwapViewResult has no model set.