Table of Contents

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

tableModel TableModel<T, TKey>

The table model to populate with data and metadata.

query IQueryable<T>

The queryable to execute.

tableState TableState

The current state of the table including filters, sorting, and pagination.

Returns

Task

A task that represents the asynchronous operation.

Type Parameters

T

The entity type being queried.

TKey

The 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.