TableController class
Core table controller that owns ALL business logic This is the single source of truth for table state and behavior
- Inheritance
-
- Object
- ChangeNotifier
- TableController
Constructors
-
TableController({required TableConfig config, required List<
Map< data})String, dynamic> > -
Create controller from config and data
factory
-
TableController.fromJson(Map<
String, dynamic> json, {void onScroll(double scrollTop, double scrollHeight, double clientHeight)?}) -
Create from JSON (convenience factory)
factory
Properties
- config → TableConfig
-
Get current config
no setter
- hashCode → int
-
The hash code for this object.
no setterinherited
- hasListeners → bool
-
Whether any listeners are currently registered.
no setterinherited
- onScroll ↔ void Function(double scrollTop, double scrollHeight, double clientHeight)?
-
Optional callback for server-side pagination / scroll position tracking.
Called on every scroll event (throttled to 100ms).
getter/setter pair
- onScrollControllersReadyCallback ↔ void Function(ScrollController vertical, ScrollController horizontal)?
-
getter/setter pair
-
onSelectionChanged
← void Function(List<
Map< )?String, dynamic> > -
Set the selection changed callback
no getter
- runtimeType → Type
-
A representation of the runtime type of the object.
no setterinherited
-
selectedRows
→ List<
Map< String, dynamic> > -
Get list of selected rows
no setter
- state → TableState
-
Get current state (immutable)
no setter
- verticalScrollController → ScrollController?
-
no setter
- visibleRowCount → int
-
Get visible row count (respects progressive loading)
no setter
Methods
-
addListener(
VoidCallback listener) → void -
Register a closure to be called when the object changes.
inherited
-
clearAllFilters(
) → void - Clear all filters
-
clearColumnFilter(
String field) → void - Clear filter for a specific column
-
clearSelection(
) → void - Clear all selection
-
collapseAll(
) → void - Collapse all tree rows
-
deleteRows(
List< String> idsToDelete) → void - Delete rows by ID (handles row_id OR temp_row_id)
-
dispose(
) → void -
Discards any resources used by the object. After this is called, the
object is not in a usable state and should be discarded (calls to
addListener will throw after the object is disposed).
override
-
expandAll(
) → void - Expand all tree rows
-
getFilterController(
String field) → TextEditingController? - Get filter controller for a specific column field
-
getHighlight(
String rowId, String columnId) → Map< String, dynamic> ? - Get highlight metadata for a specific cell Returns null if no highlight exists for this cell @param rowId - The row identifier (from _id or row_id field) @param columnId - The column field name
-
getHighlightMetadata(
) → Map< String, Map< String, dynamic> > - Get all highlight metadata for border calculation Returns a copy of the metadata map to prevent external modifications
-
getResponsiveColumnWidths(
double availableWidth) → List< double> - Get responsive column widths (scale to fit screen)
-
getSortIndicator(
String field) → SortIndicator? - Get sort indicator for a column (for UI rendering)
-
insertRowAt(
List< Map< rowsToInsert, int index) → voidString, dynamic> > - Insert rows at a specific index (surgical middle insert, no full rebuild) This is completely optional — existing insertRows() still works unchanged. Used for real-time WebSocket inserts at correct middle position.
-
insertRows(
List< Map< rowsToInsert) → voidString, dynamic> > - Insert rows (handles 1 row or many rows)
-
loadMoreRows(
) → void - Load more rows (progressive loading)
-
noSuchMethod(
Invocation invocation) → dynamic -
Invoked when a nonexistent method or property is accessed.
inherited
-
notifyListeners(
) → void -
Call all the registered listeners.
inherited
-
onScrollReady(
ScrollController vertical, ScrollController horizontal) → void - Called when scroll controllers are ready
-
removeListener(
VoidCallback listener) → void -
Remove a previously registered closure from the list of closures that are
notified when the object changes.
inherited
-
resetColumnWidths(
) → void - Reset all column widths to defaults
-
resetSort(
) → void - Reset sort to original order
-
resizeColumn(
int globalIndex, double delta) → void - Resize a column Resize a column (determines section automatically)
-
selectRows(
List< String> rowIds, Map<String, Map< rowsData) → voidString, dynamic> > - Select multiple rows
-
setColumnFilter(
String field, String value) → void - Set filter for a specific column
-
setColumnWidth(
String fieldName, double newWidth) → void - Set a column's width by field name. Equivalent to web's rownumColumn.setWidth(estimatedWidth). Works for any column (fixed or data). No-op if field not found or width unchanged. O(N columns) scan — negligible cost, touches zero row data.
-
setGlobalSearch(
String query) → void - Set global search query (searches across all columns)
-
toggleRowExpanded(
String rowId) → void - Toggle tree row expanded/collapsed
-
toggleRowSelection(
String rowId, Map< String, dynamic> rowData) → void - Toggle row selection
-
toggleSort(
String field) → void - Toggle sort on a column (3-state: none → asc → desc → none)
-
toString(
) → String -
A string representation of this object.
inherited
-
updateColumnsWithBuilders(
List< ColumnConfig> newColumns) → void - Update columns with custom cell builders (typically called after construction)
-
updateData(
List< Map< newRows) → voidString, dynamic> > - Update data (refresh with new rows)
-
updateHighlights(
Map< String, Map< newHighlights) → voidString, dynamic> > - Update cell highlight metadata (enterprise-grade: separate from values) This maintains clean separation of concerns - highlights are UI metadata, not business data. Calling this triggers a rebuild to update highlighted cells.
-
updateRows(
List< Map< rowsToUpdate) → voidString, dynamic> > - Update rows (handles 1 row or 1,000 rows, row_id OR temp_row_id) Matches web pattern: tabulator-formula.service.ts:1195-1263
Operators
-
operator ==(
Object other) → bool -
The equality operator.
inherited