Gantt Chart for a specific project

Good Day! I’m currently developing a Project Monitoring System and is tasked to create the Scheduling Module using DHTMLXGantt. In our system, we have multiple projects that have 1 schedule. Thus, we have to generate a gantt chart for every project. However, loading from the database cause all the data to be shown in the screen and not just for that specific project.

Here are my codes:

[code]import java.sql.Connection;
import java.sql.DriverManager;

import com.dhtmlx.connector.*;

import javax.servlet.annotation.WebServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

@WebServlet(name = “JSONDataServlets”, urlPatterns = {"/data1"})
public class JsonGanttDataServlet extends ThreadSafeConnectorServlet{
protected void configure(HttpServletRequest req, HttpServletResponse res) {
Connection conn=null;
try {
Class.forName (“com.mysql.jdbc.Driver”).newInstance ();
conn = DriverManager.getConnection(“jdbc:mysql://”, “root”, “”);
} catch (Throwable e) {

  JSONGanttConnector gantt = new JSONGanttConnector(conn, DBType.MySQL);
  gantt.servlet(req, res);
  gantt.render_links("gantt_links", "id", "source,target,type");
  gantt.render_table("gantt_tasks", "id", "start_date,duration,text,progress,parent", "project_id");




How to Start with dhtmlxGantt
gantt.config.xml_date = "%Y-%m-%d %H:%i"; gantt.init("gantt_here"); gantt.load("data1");
 var dp = new  dataProcessor("data1");

I also tried gantt.render_complex_sql and it works very well in showing the data. However, updates and new tasks are not automatically saved to the database:

gantt.render_complex_sql("SELECT*FROM gantt_tasks", "id", "start_date,duration,text,progress,parent","project_id");

What should I do to load the tasks from a SPECIFIC PROJECT and update/insert new tasks for that SPECIFIC PROJECT?.

check this topic

Since all tasks has project_id property that refers to the root project item, when you want to load specific project - you simply apply the filter for that project id value … enderevent

When you saving new tasks, make sure they have an appropriate project id value. You can set in on the client when the task is created … event.html