i need to custom task’s DOM, but i don’t know how to custom task’s html dom when don’t set type:project
i need to achieve this effect. how can i achieve when not set type:project to use type_renderers?
or is having another good idea?
because i don’t want its start_time and end_time to be effected
Hello Yuyang,
If a task has the project
type, it ignores the date parameters and depends on the dates of its children:
https://docs.dhtmlx.com/gantt/desktop__task_types.html#projecttasks
There is no way to change how it works.
If you want to set custom dates for the parent tasks, you can set the task
type for them.
It is not necessary to use the type_renderers
to show triangles at the sides of the parent tasks. There are other ways to do that.
You can do the same by returning custom HTML elements in the leftside_text
and rightside_text
templates and adding custom styles:
https://docs.dhtmlx.com/gantt/api__gantt_leftside_text_template.html
https://docs.dhtmlx.com/gantt/api__gantt_rightside_text_template.html
Here is an example of how it can be implemented:
https://snippet.dhtmlx.com/hnyckafx
And it is possible to do that by returning only a custom class name in the task_class
template and adding the triangles using only custom styles. This approach is explained in the following article that was published yesterday:
Here is the snippet from the article:
https://snippet.dhtmlx.com/ioxpgp6v
In the task_class
template, we check if the task has the project
type, but you can change it and check if a task has children with the hasChild
method:
https://docs.dhtmlx.com/gantt/api__gantt_haschild.html
Also, you need to change the row_height
and bar_height
parameters if you don’t want the triangles to be displayed outside the parent task rows:
https://docs.dhtmlx.com/gantt/api__gantt_row_height_config.html
https://docs.dhtmlx.com/gantt/api__gantt_bar_height_config.html
Here is the snippet with the custom triangles for the parent tasks:
https://snippet.dhtmlx.com/8g95sfrn