Resource assignment not associated to a task, or not loaded task

Hi,

In my project, I’m using the gantt + resource view. The gantt view is showing different tasks for one particular project. In the resource view, I can then see all the assignments to those tasks.
However, resources have other assignments, associated to another project task (not visible at this moment, not event loaded), or even not associated to tasks (“days off” for example). I’d like to be able to show those assignments in the resource view.
Here is a view of what I’m trying to implement :

How can I manage to do so as, by default, only assignments to visible tasks are shown.

Thanks for you help/ideas.

Hello Nickeau,
Gantt doesn’t have a built-in way to show task bars in the resource panel. You need to manually implement that. There is the resource_cell_value template where you can return any HTML elements and they will be displayed in the resource timeline cells:
https://docs.dhtmlx.com/gantt/api__gantt_resource_cell_value_template.html

By default, the template is called only when there are assigned tasks:
resource_cell_value Gantt Docs.

This is done for performance reasons. If you want to call it for every cell, you need to enable the resource_render_empty_cells config:
https://docs.dhtmlx.com/gantt/api__gantt_resource_render_empty_cells_config.html

Here is an example of how to show the task bars in the resource timeline:

However, Gantt synchronizes resource assignments with tasks. If you load assignments in the parse method and the relevant tasks don’t exist, the assignments will be removed. If you do that after the data is parsed, you will get errors that the relevant tasks don’t exist.

So, you cannot rely on the built-in functionality of resource assignments to show custom elements. You need to load assignments of non-existing tasks separately.

Here is an example that can help you to start:
https://snippet.dhtmlx.com/aidxwcex

Hello Ramil,

I already managed to show task bars quite the way I want in the resource panel, using resource_cell_value as you mentioned (still some vertical alignment improvements to do when multiple assignments in one day, not that simple).

Thanks a million for the provided example. The way I have to implement this functionality is now clear for me.
Thanks again!

1 Like