Class TableModel<T, TKey>
- Namespace
- Htmx.Components.Table.Models
- Assembly
- Htmx.Components.dll
Represents a strongly-typed table model for displaying and managing tabular data.
public class TableModel<T, TKey> : ITableModel where T : class
Type Parameters
T
The entity type displayed in the table.
TKey
The key type for the entity.
- Inheritance
-
TableModel<T, TKey>
- Implements
- Inherited Members
- Extension Methods
Constructors
TableModel(TableModelConfig<T, TKey>)
Initializes a new instance of the TableModel class with the specified configuration.
public TableModel(TableModelConfig<T, TKey> config)
Parameters
config
TableModelConfig<T, TKey>The configuration settings for the table model.
Properties
ActionsFactories
Gets or sets a collection of factory functions that generate action models for the table.
public List<Func<TableModel<T, TKey>, Task<IEnumerable<ActionModel>>>> ActionsFactories { get; set; }
Property Value
- List<Func<TableModel<T, TKey>, Task<IEnumerable<ActionModel>>>>
Columns
Gets or sets the collection of column models defining the table structure.
public List<TableColumnModel<T, TKey>> Columns { get; set; }
Property Value
- List<TableColumnModel<T, TKey>>
ModelHandler
Gets or sets the model handler responsible for data operations.
public ModelHandler<T, TKey> ModelHandler { get; set; }
Property Value
- ModelHandler<T, TKey>
PageCount
Gets or sets the total number of pages available for pagination.
public int PageCount { get; set; }
Property Value
Rows
Gets or sets the collection of row contexts representing the table data.
public List<TableRowContext<T, TKey>> Rows { get; set; }
Property Value
- List<TableRowContext<T, TKey>>
State
Gets or sets the current state of the table including sorting, filtering, and pagination.
public TableState State { get; set; }
Property Value
TypeId
Gets or sets the unique type identifier for the table model.
public string TypeId { get; set; }
Property Value
Methods
GetActionsAsync()
Gets the available actions for the table.
public Task<IEnumerable<ActionModel>> GetActionsAsync()
Returns
- Task<IEnumerable<ActionModel>>
A collection of action models for the table.