mercredi 5 août 2015

not able to load data from database in dhtmlxgantt chart


i have followed all steps for making dhtmlxgantt chart but still i am not able to display data from my database . my output from conncection data.php to mysql database is { "data":[{"id":"2","start_date":"2013-04-05 00:00:00","duration":"11","text":"Project #1","progress":"0.6","sortorder":"1","parent":"0"},{"id":"1","start_date":"2013-04-10 00:00:00","duration":"11","text":"Project #1","progress":"0.6","sortorder":"1","parent":"1"}], "collections": {"links":[{"id":"1","source":"1","target":"2","type":"1"},{"id":"2","source":"2","target":"1","type":"1"},{"id":"3","source":"2","target":"1","type":"1"}]}}

and my gantt.html code is

<!DOCTYPE html>
<style type="text/css" media="screen">
    html, body{
        margin:10px;
        padding:0px;
        height:100%;
        overflow:hidden;
    }   
</style>
<head>
   <title>How to Start with dhtmlxGantt</title>
   <script src="codebase/dhtmlxgantt.js"></script>   
   <link href="codebase/dhtmlxgantt.css" rel="stylesheet">   
</head>
<body>
    <div id="gantt_here" style='width:1000px; height:400px;'></div>
    <script type="text/javascript">
     var tasks = {
    data:[
        {id:1, text:"Test Project 1",start_date:"01-04-2013", duration:35,
        progress: 0.1, open: true},
        {id:2, text:"Wire Framing",   start_date:"03-04-2013", duration:5, 
        progress: 0,   open: true, parent:1},
        {id:3, text:"Design",   start_date:"10-04-2013", duration:20, 
        progress: 0.0, open: true, parent:1},
        {id:4, text:"Database Design", start_date:"10-04-2013", duration:5, 
        progress: 0,   open: true, parent:1},
        {id:5, text:"System Set up", start_date:"11-04-2013", duration:2, 
        progress: 0.0, open: true, parent:1},
        {id:6, text:"System Presentation", start_date:"24-04-2013", duration:1, 
        progress: 0.0, open: true, parent:1},
    {id:7, text:"Testing", start_date:"25-04-2013", duration:5, 
        progress: 0.0, open: true, parent:1},
    {id:8, text:"Bug Fixing", start_date:"30-04-2013", duration:5, 
        progress: 0.0, open: true, parent:1},
    {id:9, text:"Beta Launch", start_date:"05-05-2013", duration:1, 
        progress: 0.0, open: true, parent:1}
    ],
    links:[
        {id:1, source:1, target:2, type:"1"},
        {id:2, source:1, target:3, type:"1"},
        {id:3, source:1, target:4, type:"1"},
        {id:4, source:1, target:5, type:"1"},
        {id:5, source:1, target:6, type:"1"},
    {id:6, source:1, target:7, type:"1"},
    {id:7, source:1, target:8, type:"1"},
    {id:8, source:1, target:9, type:"1"}
    ]
};   
//  gantt.config.xml_date = "%Y-%m-%d %H:%i"; 

    gantt.init("gantt_here");   
    gantt.parse(tasks);
            gantt.load("data.php");
//  var dp=new dataProcessor("data.php");   
//  dp.init(gantt);

    </script>

    </body>
</html>

and also my data.php code is

<?php
 
include ('codebase/connector/gantt_connector.php');
 
$res=mysql_connect("localhost","root","");
mysql_select_db("gantt");
 
$gantt = new JSONGanttConnector($res);
$gantt->render_links("gantt_links","id","source,target,type");
$gantt->render_table(
    "gantt_tasks",
    "id",
    "start_date,duration,text,progress,sortorder,parent"
);
?>

so please if anyone could tell me why the data from database is not displaying it would be very helpfull. thanks in advance



via Chebli Mohamed

Aucun commentaire:

Enregistrer un commentaire