prependRows method

  1. @override
void prependRows(
  1. List<PlutoRow> rows
)
inherited

Implementation

@override
void prependRows(List<PlutoRow> rows) {
  _insertRows(0, rows);

  /// Update currentRowIdx
  if (currentCell != null) {
    setCurrentCellPosition(
      PlutoGridCellPosition(
        columnIdx: currentCellPosition!.columnIdx,
        rowIdx: rows.length + currentRowIdx!,
      ),
      notify: false,
    );

    double offsetToMove = rows.length * rowTotalHeight;

    scrollByDirection(PlutoMoveDirection.up, offsetToMove);
  }

  /// Update currentSelectingPosition
  if (currentSelectingPosition != null) {
    setCurrentSelectingPosition(
      cellPosition: PlutoGridCellPosition(
        columnIdx: currentSelectingPosition!.columnIdx,
        rowIdx: rows.length + currentSelectingPosition!.rowIdx!,
      ),
      notify: false,
    );
  }

  notifyListeners(true, prependRows.hashCode);
}