TableAdvancedController<T> constructor
TableAdvancedController<T> ({})
Controller to manage content and properties of TableAdvanced.
Use the controller to set items to display in the table and eventually
manage pagination and row checkboxes. You can use the onChangePage
callback to load new data when the user changes table page or scolls to the bottom
and then show the retrived items.
If the total number of items expected in the table is different from the
items
list lenght (i.e. in case of paginated API calls), you can specify
rowsCountToPagination
to manage pagination consequently. If not provided,
the number of items to manage the pagination will be taken by the items
list.
Implementation
TableAdvancedController({
this.items,
int? rowsCountToPaginate,
this.mode = TableMode.paginationScroll,
this.onCheckItems,
this.onChangePage,
this.rowsToShow = 10,
}) : assert(items != null || onChangePage != null),
assert(items == null || mode != TableMode.plain) {
this.rowsCountToPaginate = rowsCountToPaginate ?? items?.length ?? 0;
if (mode == TableMode.plain) {
rowsToShow = this.rowsCountToPaginate;
}
pageCount = _evaluatePageCount(
rowsToShow: rowsToShow, rowsCount: this.rowsCountToPaginate);
setItems(items ?? []);
if (mode != TableMode.plain) {
goToPage(1);
}
}