But I think I can’t use task text.
The position of the icon is dynamic.
For example,
if the value of flag = 2024.1.11 icon will be above the cell on the date 2024.1.11 above the task.
Is there another way? @Maksim_Lakatkou
Hello,
I understand your request now. You can achieve this by using addTaskLayer:
gantt.attachEvent("onGanttReady", function () {
gantt.addTaskLayer(drawIcons);
});
function drawIcons(task) {
if (task.flag) {
const flagDate = new Date(task.flag);
const sizes = gantt.getTaskPosition(task, flagDate); // Get the position for the icon on the timeline
// Create the container for the icon
const mainDiv = document.createElement('div');
mainDiv.className = 'icons';
// Create the icon element
const el = document.createElement('div');
el.setAttribute('data-task', task.id);
el.setAttribute('data-icon', 'flag');
el.className = 'icon fa fa-flag';
el.style.left = sizes.left + 'px';
el.style.top = sizes.top + 6 + 'px';
mainDiv.appendChild(el); // Append the icon to the container
return mainDiv;
}
};