Skip to main content

set-sort

Description

Fires when sorting cards

Usage

"set-sort": (
{
by?: string | ((card: object) => any),
dir?: "asc" | "desc",
columnId?: string | number,
preserve?: boolean
} | null
) => void;

Parameters

The callback of the set-sort event can take the null value or an object with the following parameters:

  • by - (optional) the card field for sorting (string or function)
  • dir - (optional) the order of sorting. The possible values are "asc" and "desc"
  • preserve - (optional) enables/disables preserving of sorting state
  • columnId - (optional) the ID of column to be sorted
info

For handling the inner events you can use the Event Bus methods

Example

// create Kanban
const board = new kanban.Kanban("#root", {
columns,
cards
});
// subscribe on the "set-sort" event
board.api.on("set-sort", (obj) => {
console.log(obj);
});

Change log: The event was added in v1.2