Multiple resources lightbox control


#1

Hi,

I’m implementing multiple resources capabilities, and using the lightbox resources control that comes with it. But that seems to re-init the owner_id object on the task (with the resource ids and values) on a lightbox save. I store other things in that object (like a date and a unique code for the back-end system), that seems to disappear after the lightbox save.

Could you check what’s happening, and if there’s a solution for keeping that object intact and only changing values? Thank you.

Kind regards,

Maurice


#2

Hello Maurice,
Unfortunately, there is no easy solution.
The current resource control completely replaces resource assignment objects on saving.
So you’ll have to do the mapping between resource assignment objects in gantt and in your store manually somehow.


#3

Alright. I’m creating a DHTMLXGrid for this now. Can you help me get started on how to get the resource assignment objects (like the standard resources control does)?


#4

Hello Maurice,
Please, check the following snippets:
https://snippet.dhtmlx.com/673adb30d
https://snippet.dhtmlx.com/1a5a1b5d5
https://snippet.dhtmlx.com/14c2be6d5
The template of the owner_id column config explains how to get owners.

The following sample allows specifying working hours, and it will be reflected in the resource chart:
https://docs.dhtmlx.com/gantt/samples/11_resources/12_work_and_material_resources.html
So, you can check gantt.templates.resource_cell_value template, as it explains which functions you need to use to get the number of hours.

And I have one more snippet that is similar to the previous sample:
https://snippet.dhtmlx.com/2100a2feb
It has a function that checks all resources and finds if they have any tasks. The resources without tasks move to “no_tasks” category.


#5

Got something working with the grid, datastore and getting assignments from one of the snippets.
Thank you!