Skip to main content

sort-tasks

Description

Fires when sorting tasks

Usage

"sort-tasks": ({
key:string,
order:"asc"|"desc"
}) => boolean | void;

Parameters

The callback of the sort-tasks action can take an object with the following parameters:

  • key - (required) data field name
  • order - (required) the sorting direction that can be "asc" or "desc"
info

For handling the actions you can use the Event Bus methods

Example

The example below demonstrates how to enable sorting for the text field.

<script>
import { getData } from "./common/data";
import { Gantt } from "wx-svelte-gantt";

const data = getData();
function init(api) {
api.intercept("sort-tasks", (config) => {
return config.key == "text";
});
}
</script>

<Gantt tasks={data.tasks} links={data.links} {init} />

Related articles: