getEditorButtons
Description
Returns the default configuration of Editor top bar buttonsUsage
getEditorButtons(options?: {
autoSave?: boolean,
resources?: boolean,
splitTasks?: boolean,
}): IEditorButtonConfig[];
Parameters
options(optional) — an object with the next parameters:autoSave— iffalse, adds the Save button to the first button group; omit or set totruewhen the editor saves automatically | PRO featureresources— adds the Resources tab that allows assigning and unassigning resources for the task | PRO featuresplitTasks— adds the Segments tab that allows managing task segments | PRO feature
Returns
Returns an array of objects with the configuration for the Editor topBar buttons:
[
{
items: [
{ /* close icon*/ },
{ /* spacer */},
{ /* Delete button*/},
{ /* Save button*/}, // if autoSave is false
],
},
{/*tabs*/},
]
Example
import { Gantt, Editor, getEditorButtons } from "@svar-ui/react-gantt";
import { useState } from "react";
function App() {
const [api, setApi] = useState(null);
const topBar = getEditorButtons({
autoSave: false,
resources: true,
splitTasks: true,
});
return (
<>
<Gantt ref={setApi} tasks={tasks} links={links} scales={scales} />
<Editor api={api} topBar={topBar} />
</>
);
}
Related articles: