Gantt multiple resources Assigning with histogram



Now i am customizing gantt with resource histogram using https://docs.dhtmlx.com/gantt/samples/11_resources/09_resource_histogram.html
example. Am facing a issue in constructing json using php gantt connector .
in Loghtbox
{ name: “owner”, type: “resources”, map_to: “owner”, options: gantt.serverList(“people”), default_value:WORK_DAY, unassigned_value: UNASSIGNED_ID},

In Task Table owner field Data Type : TEXT In this field data stored like this [{“resource_id”: “6”," value": “5”}]
In gantt.load (load.php)
In browser console :
“data”: [
{ “id”: 1, “text”: “Office itinerancy”, “type”: “project”, “start_date”: “02-04-2019 00:00”, “duration”: 17, “progress”: 0.4, “owner”: " [{“resource_id”:“5”, “value”: 3}] " , “parent”: 0},

Instead of

“data”: [
{ “id”: 1, “text”: “Office itinerancy”, “type”: “project”, “start_date”: “02-04-2019 00:00”, “duration”: 17, “progress”: 0.4, “owner”: [{“resource_id”:“5”, “value”: 3}] , “parent”: 0},


include (‘codebase/connector/gantt_connector.php’);

$res = new PDO(“mysql:host=localhost;dbname=gantt”, “root”, “”);

$gantt = new JSONGanttConnector($res);

owner getting as string instead of object. How do i fix this ?


Hello Janani,
In our samples, the values for the owner property are stored as an array, not as a string:
And you store the owner parameter as a string:

In Task Table owner field Data Type : TEXT In this field data stored like this [{“resource_id”: “6”," value": “5”}]

If I remember correctly, it is easier to create a different table and connect several tables, than to implement a solution to store arrays:

However, you can still store the arrays as strings, but you need to parse them after loading tasks.
To do that, you need to use the eachTask method:

  if (task.owner && typeof task.owner == 'string') {
    task.owner = eval(task.owner);

Here is an example of how it works:


You must be very careful while applying any solution because sometimes
many forum members are not able to answer the question but still they
answer it anyhow. So, It’s important to confirm the solution and then apply it.