Skip to main content

open-resource-row

The functionality is available in PRO Edition only

PRO

Description

Fires when a parent resource row is expanded or collapsed in ResourceLoad

See ResourceLoad component API

Usage

"open-resource-row": ({
id: string | number,
mode: boolean,
}) => boolean | void;
info

For handling the actions you can use the Event Bus methods

Parameters

The callback of the open-resource-row action takes an object with the following parameters:

  • id - (required) the ID of the parent resource row to expand or collapse
  • mode - (required) true to expand the row, false to collapse it

Example

Use the api.exec method to expand or collapse a resource row programmatically:

import { useState, useRef } from "react";
import { getData } from "./common/data";
import { Gantt, ResourceLoad } from "@svar-ui/react-gantt";

const { tasks, scales, resources, assignments } = getData();

function App() {
const [api, setApi] = useState(null);

function init(api) {
api.exec("open-resource-row", { id: "team1", mode: true });
}

return (
<>
<Gantt
tasks={tasks}
scales={scales}
resources={resources}
assignments={assignments}
init={init}
apiRef={setApi}
/>
<ResourceLoad api={api} />
</>
);
}

export default App;

Related articles: