а

Integarting gantt in php application


#1

Hi ,

Can anyone help me what is database structure for gantt with resources. How I will get the resources from database instead of

resourcesStore.parse([
{id: 1, text: “QA”, parent:null},
{id: 2, text: “Development”, parent:null},
{id: 3, text: “Sales”, parent:null},
{id: 4, text: “Other”, parent:null},
{id: 5, text: “Unassigned”, parent:4},
{id: 6, text: “John”, parent:1, unit: “hours/day” },
{id: 7, text: “Mike”, parent:2, unit: “hours/day” },
{id: 8, text: “Anna”, parent:2, unit: “hours/day” },
{id: 9, text: “Bill”, parent:3, unit: “hours/day” },
{id: 10, text: “Floe”, parent:3, unit: “hours/day” }
]);

how I will store the newly created task into database


#2

Hello Sravanthi,
Gantt doesn’t save the resource data into a database. You need to implement a custom solution if you want to do that.
Here is the snippet where Gantt saves the resource data as JSON data:
https://snippet.dhtmlx.com/7d2c70130

If you just need to save resource names like you listed, you need to create a table with the following fields:

CREATE TABLE `resource_data` (
  `id` int(11) NOT NULL AUTO_INCREMENT,
  `text` varchar(255) NOT NULL,
  `parent` int(11) NOT NULL,
  `unit` varchar(255) NOT NULL,
  PRIMARY KEY (`id`)
);

Then you need to load the data from that table into a variable and call resourcesStore.parse(your_variable).
Unfortunately, I don’t have a ready demo.

how I will store the newly created task into database

Usually, new tasks are saved automatically, if you follow this guide:
https://docs.dhtmlx.com/gantt/desktop__howtostart_php.html#step3configuringadatabase