Skip to main content

set-sort

Description

Triggered when cards are sorted

Usage

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

Parameters

The callback for the set-sort event accepts either null or an object containing the following options:

  • by - (optional) specifies the card field used for sorting (string or function)
  • dir - (optional) defines the sorting direction, either "asc" or "desc"
  • preserve - (optional) controls whether the sorting state is kept
  • columnId - (optional) identifies the column to be sorted by its ID
info

To work with internal 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: This event was introduced in v1.2