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
ITableProviderThe table provider for table-related operations.
viewPaths
ViewPathsThe 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
TableEditActionAttributeThe TableEditActionAttribute instance.
cad
ControllerActionDescriptorThe controller action descriptor.
Returns
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
TableEditActionAttributeThe TableEditActionAttribute that triggered this filter.
multiSwapViewResult
MultiSwapViewResultThe MultiSwapViewResult to update with table component content.
context
ResultExecutingContextThe result executing context.
Returns
- Task
A completed task as this operation is synchronous.
Exceptions
- InvalidOperationException
Thrown when the MultiSwapViewResult has no model set.