Interface ITableProvider
- Namespace
- Htmx.Components.Table
- Assembly
- Htmx.Components.dll
Provides functionality for fetching and processing table data.
public interface ITableProvider
- Extension Methods
Remarks
The table provider handles pagination, filtering, sorting, and data retrieval for table models. It uses asynchronous query execution when the source provider supports it and falls back to synchronous LINQ execution for in-memory sources.
Methods
FetchPageAsync<T, TKey>(TableModel<T, TKey>, IQueryable<T>, TableState)
Uses the given columns and tableState to extend the given queryable for appropriate filtering and sorting, and then executes the query twice; once to count rows so that PageCount can be calculated, and once with pagination applied. Places the results in the given TableModel<T, TKey>.
Task FetchPageAsync<T, TKey>(TableModel<T, TKey> tableModel, IQueryable<T> query, TableState tableState) where T : class
Parameters
tableModelTableModel<T, TKey>The table model to populate with data and metadata.
queryIQueryable<T>The queryable to execute.
tableStateTableStateThe current state of the table including filters, sorting, and pagination.
Returns
- Task
A task that represents the asynchronous operation.
Type Parameters
TThe entity type being queried.
TKeyThe key type for the entity.
Remarks
This method applies filtering, sorting, and pagination to the query in sequence, then executes both a count query and a data query to populate the table model with the appropriate page of data and total page count.
Exceptions
- ArgumentNullException
Thrown when any parameter is null.
- InvalidOperationException
Thrown when no sortable column is found for default sorting.