pageTo method
Ensures that the given row is visible. align
params makes sure that
starting index will be aligned to page size, e.g. if page size is 5, row with
index 7 (ordinal number 8) is requested, rather than showing rows 8 - 12
starting page at row 7 it will make first row index 5 displaying 6-10
Implementation
@override
void pageTo(int rowIndex, [bool align = true]) {
if (_operationInProgress == _TableOperationInProgress.none) {
_aligned = align;
// int oldFirstRowIndex = _firstRowIndex;
_operationInProgress = _TableOperationInProgress.pageTo;
// if row requested happens to be outside the available range - change it to the last aligned page
if (rowIndex > _rowCount - 1) {
_rowIndexRequested = _lastAligned(rowIndex);
} else {
_rowIndexRequested = align
? _alignRowIndex(rowIndex, _effectiveRowsPerPage)
: math.max(math.min(_rowCount - 1, rowIndex), 0);
}
var source = widget.source as AsyncDataTableSource;
source._fetchData(_rowIndexRequested, _effectiveRowsPerPage);
}
}