Skip to main content

sort-files

Description

Fires when sorting files

Usage

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

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

import { getData, getDrive } from "./common/data";
import { Filemanager } from "@svar-ui/react-filemanager";

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

export default function App() {
return (
<Filemanager
data={getData()}
drive={getDrive()}
init={init}
/>
);
}

Related articles: How to access File Manager API