Is there a way to programmatically collapse and / or drag the splitter that separate the Gantt with grid?
Support Forum
Works fine setting width. A bit more hard was to sync the collapse/expand since there are just two events that I found, but in the end it seems to works.
Thanks for your tips.
Code:
gantt.on({
thisObj: gantt,
splitterCollapseClick: ({ source }: { source: GanttInstance }) => {
ganttInstances.forEach((gantt) => {
if (gantt.project.id !== source.project.id) {
if (!gantt.subGrids.locked.collapsed && !gantt.subGrids.normal.collapsed) {
// The splitter is in the middle, collapse grid
gantt.subGrids.locked.collapse();
} else if (gantt.subGrids.normal.collapsed) {
// The gantt is collapsed, expand it
gantt.subGrids.normal.expand();
}
}
});
},
splitterExpandClick: ({ source }: { source: GanttInstance }) => {
ganttInstances.forEach((gantt) => {
if (gantt.project.id !== source.project.id) {
if (!gantt.subGrids.locked.collapsed && !gantt.subGrids.normal.collapsed) {
// The splitter is in the middle, collapse gantt
gantt.subGrids.normal.collapse();
} else if (gantt.subGrids.locked.collapsed) {
// The grid is collapsed, expand it
gantt.subGrids.locked.expand();
}
}
});
},
splitterDragEnd: ({ source }: { source: GanttInstance }) => {
ganttInstances.forEach((gantt) => {
if (gantt.project.id !== source.project.id) {
gantt.subGrids.locked.width = source.subGrids.locked.width;
gantt.subGrids.normal.width = source.subGrids.normal.width;
}
});
},
});