TTableModel is the class responsible for modeling the data that makes up a table. It determines how many rows, columns and cells are in the table. It also determines the values that should be used for cells, the row captions and the column captions. Finally, it controls how the data in the table can be changed, sorted and filtered. The class TTableModel is an abstract base class for specific table models that can be implemented in various ways. The model uses Integer indexes to locate rows, columns and cells and all operations on the model can be restricted to a subrange within each dimension.
The following are examples of the table models that the Charta Platform currently supports.
TListTableModel
TListTableModel models a table for a list of Charta objects belonging to the same class. There is a row for every object and a column for every member of the class.
TSQLDatabaseTableModel
TSQLDatabaseTableModel models a table from an SQL database. This table can either be a physical table within the database or a table resulting from a query.
TRowSortingTableModel
TRowSortingTableModel adds row sorting capabilities to another TTableModel. Some table models natively support sorting, like the TSQLDatabaseTableModel. Other table models do not and one can use this functionality for sorting the rows.
TPivotTableModel
TPivotTableModel adds pivot capabilities to another TTableModel. For a three column table it shows the unique values for the first column as row captions, the unique values in the second column as column captions and finally the value of the third column is shown in the "table body".