Class TableViewComponent
- Namespace
- Htmx.Components.Table
- Assembly
- Htmx.Components.dll
View component that renders table data using the configured table model and view paths.
public class TableViewComponent : ViewComponent
- Inheritance
-
TableViewComponent
- Inherited Members
- Extension Methods
Examples
Usage in a Razor view:
@await Component.InvokeAsync("Table", tableModel)
Remarks
This component integrates with the HTMX Components table system to provide interactive data tables with pagination, sorting, filtering, and CRUD operations. It uses the table model to determine how data should be displayed and which views should be used for rendering different table parts.
Constructors
TableViewComponent(ViewPaths)
Initializes a new instance of the TableViewComponent class.
public TableViewComponent(ViewPaths viewPaths)
Parameters
viewPaths
ViewPathsThe configured view paths for rendering table components.
Exceptions
- ArgumentNullException
Thrown when
viewPaths
is null.
Methods
Invoke(ITableModel)
Invokes the view component to render a table using the provided table model.
public IViewComponentResult Invoke(ITableModel model)
Parameters
model
ITableModelThe table model containing data, columns, and configuration for rendering.
Returns
- IViewComponentResult
A view component result that renders the table using the configured table view.
Remarks
This method sets the table view paths on the model and delegates rendering to the configured table view. The table view is responsible for rendering headers, body, pagination, and other table elements.
Exceptions
- ArgumentNullException
Thrown when
model
is null.