I want to change the color of Gantt based on the critical path button how can I implement the button to onToggle on any method so that based on my status condition the Gantt color will change.
Thanks
Hi,
You could use these css to style the tasks
/* style for child task */
.b-ganttbase.b-gantt-critical-paths .b-gantt-task.b-critical {
background-color: #d25d3c;
}
/* style for parent task */
.b-ganttbase.b-gantt-critical-paths .b-gantt-task-parent .b-gantt-task.b-critical {
background-color: #cd4866;
}
Hi,
You could use this code for example
tbar : [
{
type : 'button',
color : 'b-red',
icon : 'b-fa-square',
pressedIcon : 'b-fa-check-square',
ref : 'criticalPathsButton',
text : 'Highlight Critical Paths',
toggleable : true,
pressed : true,
onToggle({ pressed }) {
// toggle critical paths feature disabled/enabled state
gantt.features.criticalPaths.disabled = !pressed;
}
}
]
I've got this code from our online demo here https://bryntum.com/products/gantt/examples/criticalpaths/
And you should not use ganttConfig in frameworks to disable features or anything, cause it's not the Gantt instance.
Hope this will help.
Let us know if you have any other questions.