setPage method
void
setPage(
- int page, {
- bool resetCurrentState = true,
- bool notify = true,
})
inherited
Implementation
@override
void setPage(
int page, {
bool resetCurrentState = true,
bool notify = true,
}) {
_state._page = page;
int from = (page - 1) * pageSize;
if (from < 0) {
from = 0;
}
int to = page * pageSize;
if (to > _length) {
to = _length;
}
if (enabledRowGroups) {
PlutoRow lastRow(PlutoRow row) {
return isExpandedGroupedRow(row) &&
row.type.group.children.filterOrOriginalList.isNotEmpty
? lastRow(row.type.group.children.filterOrOriginalList.last)
: row;
}
if (_rowsToPaginate.isEmpty) {
from = 0;
to = 0;
} else {
var fromRow = _rowsToPaginate.elementAt(from);
var toRow = lastRow(_rowsToPaginate.elementAt(to - 1));
from = refRows.filterOrOriginalList.indexOf(fromRow);
to = refRows.filterOrOriginalList.indexOf(toRow) + 1;
}
}
_range.setRange(from, to);
refRows.setFilterRange(_range);
if (resetCurrentState) {
clearCurrentCell(notify: false);
clearCurrentSelecting(notify: false);
}
notifyListeners(notify, setPage.hashCode);
}