java - How to open an empty gantt chart? -


in web java application need create many projects need open new empty gantt everytime want, problem table tasks contains other projects , if want create new project page display old tasks, can trick, please help. index.html

  <form action="newgantt.html">  <input type="submit" value="gantt" > </form> 

newgantt.html

<body> <div id="gantt_here" style="width:100%; height:500px;"></div> <script type="text/javascript">            gantt.config.xml_date = "%y-%m-%d %h:%i";             gantt.config.scale_unit = "day";             gantt.config.duration_unit = "day";             gantt.config.date_scale = "%d";      gantt.init("gantt_here");     gantt.load("conector");      var dp = new  dataprocessor("conector");     dp.init(gantt); 

conector.java

@override protected void configure(httpservletrequest req, httpservletresponse res) {     connection conn = null;     try {         class.forname("com.mysql.jdbc.driver").newinstance();         conn = drivermanager.getconnection("jdbc:mysql://localhost:3306/test", "root", "");     } catch (throwable e) {         e.printstacktrace();     }     jsonganttconnector gantt = new jsonganttconnector(conn, dbtype.mysql);     gantt.servlet(req, res);     gantt.mix("open", "1");  gantt.enable_order("sortorder");  gantt.render_links("gantt_links", "id", "source,target,type");  gantt.render_table("tasks", "id","text", "start_date,duration,progress,sortorder");  } 

you have 1 object "gantt", reference of gantt. if u want create new gantt, u need destroy old gantt , reload data :

if(gantt) {    gantt.destructor(); } 

or add new gantt object :

function init() {     gantt1 = gantt.getganttinstance();     gantt1.init("first");     gantt1.parse(firsttask);      gantt2 = gantt.getganttinstance();     gantt2.init("second");     gantt2.parse(secondtask);    }   <body onload="init();">     <div id="first" class="dhx_cal_container" ...>         ...     </div>     <br>     <div id="gantt_here_2" class="dhx_cal_container" ...>         ...     </div>   </body> 

Comments

Popular posts from this blog

php - failed to open stream: HTTP request failed! HTTP/1.0 400 Bad Request -

java - How to filter a backspace keyboard input -

java - Show Soft Keyboard when EditText Appears -