Skip to main content

sort-files

Description

Fires when sorting files

Usage

"sort-files": ({
key: string,
order: "asc" | "desc",
panel?: 0 | 1,
path?: string
})

Parameters

The callback of the sort-files action takes an object with the following parameters:

  • key - (required) specifies the field to sort by
  • order- (required) specifies the direction to sort by: "asc" | "desc"
  • panel - (optional) defines the panel where the action takes place (0 (left) | 1 (right))
  • path - (optional) the ID of a folder where files are sorted

Example

<script>
import { getData, getDrive } from "./common/data";
import { Filemanager } from "@wx/svelte-filemanager";

let api;

$: if (api) {
api.exec("sort-files", {
key: "name",
order: "desc",
});
}

</script>

<Filemanager
data={getData()}
drive={getDrive()}
bind:api />

Related articles: How to access File Manager API