我正在为我们的项目做一个Scheduling模块,为了实现这个目标,我们将使用DHTMLX Gantt。但是,我无法存储输入到甘特图中的值!
这是我的图表代码
<!DOCTYPE html>
<html>
<head>
<link href="codebase/dhtmlxgantt.css" rel="stylesheet">
<script src="http://export.dhtmlx.com/gantt/api.js"></script>
<script src="codebase/dhtmlxgantt.js"></script>
<style type="text/css" media="screen">
html, body{
margin:0px;
padding:0px;
height:100%;
overflow:hidden;
}
</style>
</head>
<body>
<input value="Export to PDF" type="button" onclick='gantt.exportToPDF()'>
<div id="gantt_here" style='width:1000px; height:400px;'></div>
<script type="text/javascript">
gantt.init("gantt_here");
gantt.load("events.php");
var dp = new dataProcessor("events.php");
dp.init(gantt);
</script>
</body>
</html>
这是events.php的代码
include ('codebase/connector/db_sqlite3.php');
include ('codebase/connector/gantt_connector.php');
$dbtype = "MySQL";
$res=mysql_connect("localhost", "root", "");
mysql_select_db("myfirstdb");
$gantt = new JSONGanttConnector($res, $dbtype);
$gantt->mix("open", 1);
$gantt->render_links("gantt_links", "id", "source,target,type");
$gantt->render_table("gantt_tasks","id",
"start_date,duration,text,progress,sortorder,parent");
?>
什么似乎是问题?
答案 0 :(得分:0)
你的PHP代码似乎没问题。尝试保存事件时会发生什么,是否可以检查服务器响应?它可能包含错误消息。 尝试启用gantt连接器的日志记录,以便您可以看到实际的sql请求及其结果 http://docs.dhtmlx.com/connector__php__errors.html
另一件事 - 确保您已为id列启用自动增量,否则连接器将无法插入新记录