Resource assignment


#1

Hello,

I would like to know that is there any way to assign a task to multiple resources with various assignment type.

As an example:
If the task duration is 3 days then we assign 2, 5 and 8 hours for the first, second and third days for a resource.
There may be some other resources in system.

Thank you


#2

Hello,
There is no built-in solution for that.
You can show anything in the resource cell using conditions and returning different values:
http://snippet.dhtmlx.com/f9c542e2f
But the resource grid and the resource timeline do not share the values, so you will need to implement your own solution to calculate the total amount of hours.


#3

Hey ramil I saw your snippet and have a question:
Is it possible to show data in the resource grid which is not connected to the task on top?

I need to calculate the resources from another source than the tasks and don’t know how to implement it.


#4

Hello Patrik,
Yes, you can show any data and any HTML element in the resource cell. To do that, you need to use the resource_cell_value template:
https://docs.dhtmlx.com/gantt/api__gantt_resource_cell_value_template.html
Here is an example of how it might work:


http://snippet.dhtmlx.com/643d1db11

Please, note that it is better to move the calculations outside that template as the values might change every time Gantt updates the chart. For example, you can move any task in the timeline and you will see that the values in the resource chart are updated.


#5

Hi Ramil

Thanks for your reply, I tried that, unfortunally that does not work if there is no tasks for that user on that day, see:
http://snippet.dhtmlx.com/c7ebbf549

“Test” doesn’t show up for the users Bill & Floe. I need something to fill the resource table with other data than the tasks above.


#6

Hello Patrik,
In that case, you can enable resource_render_empty_cells property:
https://docs.dhtmlx.com/gantt/api__gantt_resource_render_empty_cells_config.html
It will allow showing all cells for all resources:
http://snippet.dhtmlx.com/9c99528b2


#7

exactly what I was looking for, thank you ramil, you saved my day :slight_smile: