toggleSortColumn method

  1. @override
void toggleSortColumn(
  1. PlutoColumn column
)
inherited

Toggle column sorting.

It works when you tap the title area of a column. When called, PlutoGrid.onSorted callback is called. (If registered)

sortAscending, sortDescending, sortBySortIdx also sort the column, but do not call the PlutoGrid.onSorted callback.

Implementation

@override
void toggleSortColumn(PlutoColumn column) {
  final oldSort = column.sort;

  if (column.sort.isNone) {
    sortAscending(column, notify: false);
  } else if (column.sort.isAscending) {
    sortDescending(column, notify: false);
  } else {
    sortBySortIdx(column, notify: false);
  }

  _callOnSorted(column, oldSort);

  notifyListeners(true, toggleSortColumn.hashCode);
}