Icon on milestone


We want to show an icon superimposed on the milestone. Could you please let me know how to do it?


Hello Pravin,
You can use the addTaskLayer feature that allows displaying any HTML elements in the timeline:
Here is an example of how it might be implemented:

Hi Ramil,

We want to show taskLayer for children whose parent is marked as split. When we tried that, addTaskLayer is not called for children of split task. How can we achieve it?

Here is the code snippet which we tried. But it shows icon twice.

Hello Pravin,
Unfortunately, right now, the addTaskLayer method is not called for the split tasks. The dev team will fix that bug in the future, but I cannot give you any ETA.

So, as a workaround, you need to check if the parent task is rendered in the split mode and add the elements on its row for each child task.

In your implementation, you call the same code for Task #3 and for Project #2 tasks, so the custom elements are displayed twice. In other words, when the addTaskLayer method is called for Project #2, you iterate child tasks of Project #2 and add the icons. Then the addTaskLayer method is called for Task #3, and you iterate child tasks of Project #2 and add the icons.

Instead of that, you can iterate the child elements of the task object by using the eachTask method:
The second argument of that method allows iterating only child tasks of the specified task.