2015-04-12 22 views
0

我在Java EE項目使用dhtmlxgantt Java連接器,我下載的Java連接器,我從這個鏈接Java Connector for dhtmlxGanttmix()enable_order()JsonGanttConnector .Thanks忽略複製這個例子。爲dhtmlxGantt

Test_conector.java

import com.dhtmlx.connector.DBType; 
import com.dhtmlx.connector.JSONGanttConnector; 
import java.sql.Connection; 
import java.sql.DriverManager; 
import com.dhtmlx.connector.*; 
import javax.servlet.http.HttpServletRequest; 
import javax.servlet.http.HttpServletResponse; 

public class Test_conector extends ThreadSafeConnectorServlet { 

@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/parc","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("gantts", "id","text", "start_date,duration,progress,sortorder,parent"); 

} 
} 

回答

0

.mix和.enable_order API僅在連接器的PHP版本。

您可以使用beforeRender行爲來爲數據對象定義open屬性。據我所知,除了enable_order API之外,沒有其他選擇。

+0

謝謝,但我該如何定義打開的屬性?沒有使用Java Connector的其他解決方案嗎? –