You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
|`showCheckboxColumn`|`boolean`|`true`| Show a checkbox column for multi-select. Only applies when `enableSelection` is `true`. |
102
-
|`toolbarItems`|`ToolbarItem[]`|`[]`| Custom controls rendered in the toolbar alongside the built-in zoom and export buttons. See [Custom Toolbar](#custom-toolbar). |
103
100
|`tooltipId`|`string`|`'apexgantt-tooltip-container'`| HTML `id` for the tooltip container element. |
104
101
|`tooltipTemplate`|`(task, dateFormat) => string`| built-in | Custom function returning an HTML string for the task tooltip. |
105
102
|`tooltipBorderColor`|`string`|`'#BCBCBC'`| Border color of the tooltip. |
ApexGantt ships with built-in light and dark themes. Use the `theme` option to select a preset, or supply a full `GanttTheme` object for complete control.
Clear all selected tasks. Requires `enableSelection: true`.
529
-
530
-
```js
531
-
ganttInstance.clearSelection();
532
-
```
533
-
534
-
### 8. `renderToolbar(container)`
535
-
536
-
Render the built-in toolbar into a custom DOM element. Normally called automatically by `render()`. Use this only when you need to mount the toolbar in a custom slot outside the chart.
Returns `true` after `destroy()` has been called, `false` while the chart is live. Use this guard before calling other methods when you are unsure whether the instance is still active.
546
-
547
-
```js
548
-
if (!ganttInstance.isDestroyed()) {
549
-
ganttInstance.update({series: newTasks});
550
-
}
551
-
```
552
-
553
-
### 10. `destroy()`
554
-
555
-
Destroy the chart instance and free all associated resources. Removes all event listeners, disconnects `ResizeObserver`s, clears the tooltip, and clears the DOM. After calling `destroy()` the instance cannot be reused — create a new `ApexGantt` instead.
556
-
557
-
Always call `destroy()` before removing the host element from the DOM or when cleaning up in frameworks.
558
-
559
-
```js
560
-
// React cleanup example
561
-
useEffect(() => {
562
-
constgantt=newApexGantt(ref.current, options);
563
-
gantt.render();
564
-
return () =>gantt.destroy();
565
-
}, []);
566
-
```
567
-
568
-
## Custom Toolbar
569
-
570
-
Add custom buttons, dropdowns, and separators to the toolbar alongside the built-in zoom and export controls. Pass an array of `ToolbarItem` objects to the `toolbarItems` option.
571
-
572
-
### Toolbar Button
573
-
574
-
```js
575
-
importApexGantt, {GanttEvents} from'apexgantt';
576
-
577
-
constgantt=newApexGantt(element, {
578
-
series: tasks,
579
-
enableSelection:true,
580
-
toolbarItems: [
581
-
{
582
-
type:'button',
583
-
label:'Export Selected',
584
-
tooltip:'Export selected tasks to CSV',
585
-
position:'right', // 'left' inserts before built-in controls
586
-
requiresSelection:true, // auto-disabled when nothing is selected
|`taskDragged`| Task bar is dragged to a new position |`{ taskId, oldStartTime, oldEndTime, newStartTime, newEndTime, daysMoved, affectedChildTasks, timestamp }`|
659
-
|`taskResized`| Task bar is resized via its handles |`{ taskId, resizeHandle, oldStartTime, oldEndTime, newStartTime, newEndTime, durationChange, timestamp }`|
0 commit comments