dhtmlxGantt 给我一个空白页

发布于 2024-11-18 15:54:35 字数 4845 浏览 3 评论 0原文

我对创建甘特图感兴趣。经过长时间的搜索,我找到了“dhtmlxGantt”

http://www.dhtmlx.com/ docs/products/dhtmlxGantt/index.shtml

中尝试了 dhtmlxGantt 的示例

我在http://www.dhtmlx.com/docs/products/dhtmlxGantt/download/dhtmlxGantt .zip

我现在的问题是,当我尝试运行我的应用程序时,dhtmlxGantt 给我一个空白页面,因为它无法从 javascript 文件获取某些功能!

这是我的代码:

<?xml version='1.0' encoding='UTF-8' ?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml"
      xmlns:h="http://java.sun.com/jsf/html">
    <h:head>
        <title>Facelet Title</title>
    </h:head>
    <body>
        Hello from Facelets

<link type="text/css" rel="stylesheet" href="./dhtmlxGantt/codebase/dhtmlxgantt.css"/>
<script type="text/javascript" language="JavaScript" src="./dhtmlxGantt/codebase/dhtmlxcommon.js"></script>
<script type="text/javascript" language="JavaScript" src="./dhtmlxGantt/codebase/dhtmlxgantt.js"></script>
<script type="text/javascript" language="JavaScript">
/*<![CDATA[*/
function createChartControl(htmlDiv1)
{
    // Initialize Gantt data structures
    //project 1
    var project1 = new GanttProjectInfo(1, "Applet redesign", new Date(2010, 5, 11));
    var parentTask1 = new GanttTaskInfo(1, "Old code review", new Date(2010, 5, 11), 208, 50, "");
    parentTask1.addChildTask(new GanttTaskInfo(2, "Convert to J#", new Date(2010, 5, 11), 100, 40, ""));
    parentTask1.addChildTask(new GanttTaskInfo(13, "Add new functions", new Date(2010, 5, 12), 80, 90, ""));
    var parentTask2 = new GanttTaskInfo(3, "Hosted Control", new Date(2010, 6, 7), 190, 80, "1");
    var parentTask5 = new GanttTaskInfo(5, "J# interfaces", new Date(2010, 6, 14), 60, 70, "6");
    var parentTask123 = new GanttTaskInfo(123, "use GUIDs", new Date(2010, 6, 14), 60, 70, "");
    parentTask5.addChildTask(parentTask123);
    parentTask2.addChildTask(parentTask5);
    parentTask2.addChildTask(new GanttTaskInfo(6, "Task D", new Date(2010, 6, 10), 30, 80, "14"));
    var parentTask4 = new GanttTaskInfo(7, "Unit testing", new Date(2010, 6, 15), 118, 80, "6");
    var parentTask8 = new GanttTaskInfo(8, "core (com)", new Date(2010, 6, 15), 100, 10, "");
    parentTask8.addChildTask(new GanttTaskInfo(55555, "validate uids", new Date(2010, 6, 20), 60, 10, ""));
    parentTask4.addChildTask(parentTask8);
    parentTask4.addChildTask(new GanttTaskInfo(9, "Stress test", new Date(2010, 6, 15), 80, 50, ""));
    parentTask4.addChildTask(new GanttTaskInfo(10, "User interfaces", new Date(2010, 6, 16), 80, 10, ""));
    parentTask2.addChildTask(parentTask4);
    parentTask2.addChildTask(new GanttTaskInfo(11, "Testing, QA", new Date(2010, 6, 21), 60, 100, "6"));
    parentTask2.addChildTask(new GanttTaskInfo(12, "Task B (Jim)", new Date(2010, 6, 8), 110, 1, "14"));
    parentTask2.addChildTask(new GanttTaskInfo(14, "Task A", new Date(2010, 6, 7), 8, 10, ""));
    parentTask2.addChildTask(new GanttTaskInfo(15, "Task C", new Date(2010, 6, 9), 110, 90, "14"));
    project1.addTask(parentTask1);
    project1.addTask(parentTask2);
    //project 2
    var project2 = new GanttProjectInfo(2, "Web Design", new Date(2010, 5, 17));
    var parentTask22 = new GanttTaskInfo(62, "Fill HTML pages", new Date(2010, 5, 17), 157, 50, "");
    parentTask22.addChildTask(new GanttTaskInfo(63, "Cut images", new Date(2010, 5, 22), 78, 40, ""));
    parentTask22.addChildTask(new GanttTaskInfo(64, "Manage CSS", null, 90, 90, ""));
    project2.addTask(parentTask22);
    var parentTask70 = new GanttTaskInfo(70, "PHP coding", new Date(2010, 5, 18), 120, 10, "");
    parentTask70.addChildTask(new GanttTaskInfo(71, "Purchase D control", new Date(2010, 5, 18), 50, 0, ""));
    project2.addTask(parentTask70);
    // Create Gantt control
    var ganttChartControl = new GanttChart();
    // Setup paths and behavior
    ganttChartControl.setImagePath("./dhtmlxGantt/codebase/imgs/");
    ganttChartControl.setEditable(true);
    ganttChartControl.showTreePanel(true);
    ganttChartControl.showContextMenu(true);
    ganttChartControl.showDescTask(true,'d,s-f');
    ganttChartControl.showDescProject(true,'n,d');
    // Load data structure        
    ganttChartControl.addProject(project1);
    ganttChartControl.addProject(project2);
    // Build control on the page
    ganttChartControl.create(htmlDiv1);
}
/*]]>*/
</script>



    <div style="width:950px; height:620px; position:relative;" id="GanttDiv"></div>
        </body>
    </html>

有人可以帮助我吗?

I'm interested in creating a GanttChart. After a long search I found "dhtmlxGantt"

http://www.dhtmlx.com/docs/products/dhtmlxGantt/index.shtml

I tried the sample of dhtmlxGantt in

http://www.dhtmlx.com/docs/products/dhtmlxGantt/download/dhtmlxGantt.zip

My problem now is when I try to run my application the dhtmlxGantt give me a blank page because it can't get some function from javascript file!

Here is my code:

<?xml version='1.0' encoding='UTF-8' ?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml"
      xmlns:h="http://java.sun.com/jsf/html">
    <h:head>
        <title>Facelet Title</title>
    </h:head>
    <body>
        Hello from Facelets

<link type="text/css" rel="stylesheet" href="./dhtmlxGantt/codebase/dhtmlxgantt.css"/>
<script type="text/javascript" language="JavaScript" src="./dhtmlxGantt/codebase/dhtmlxcommon.js"></script>
<script type="text/javascript" language="JavaScript" src="./dhtmlxGantt/codebase/dhtmlxgantt.js"></script>
<script type="text/javascript" language="JavaScript">
/*<![CDATA[*/
function createChartControl(htmlDiv1)
{
    // Initialize Gantt data structures
    //project 1
    var project1 = new GanttProjectInfo(1, "Applet redesign", new Date(2010, 5, 11));
    var parentTask1 = new GanttTaskInfo(1, "Old code review", new Date(2010, 5, 11), 208, 50, "");
    parentTask1.addChildTask(new GanttTaskInfo(2, "Convert to J#", new Date(2010, 5, 11), 100, 40, ""));
    parentTask1.addChildTask(new GanttTaskInfo(13, "Add new functions", new Date(2010, 5, 12), 80, 90, ""));
    var parentTask2 = new GanttTaskInfo(3, "Hosted Control", new Date(2010, 6, 7), 190, 80, "1");
    var parentTask5 = new GanttTaskInfo(5, "J# interfaces", new Date(2010, 6, 14), 60, 70, "6");
    var parentTask123 = new GanttTaskInfo(123, "use GUIDs", new Date(2010, 6, 14), 60, 70, "");
    parentTask5.addChildTask(parentTask123);
    parentTask2.addChildTask(parentTask5);
    parentTask2.addChildTask(new GanttTaskInfo(6, "Task D", new Date(2010, 6, 10), 30, 80, "14"));
    var parentTask4 = new GanttTaskInfo(7, "Unit testing", new Date(2010, 6, 15), 118, 80, "6");
    var parentTask8 = new GanttTaskInfo(8, "core (com)", new Date(2010, 6, 15), 100, 10, "");
    parentTask8.addChildTask(new GanttTaskInfo(55555, "validate uids", new Date(2010, 6, 20), 60, 10, ""));
    parentTask4.addChildTask(parentTask8);
    parentTask4.addChildTask(new GanttTaskInfo(9, "Stress test", new Date(2010, 6, 15), 80, 50, ""));
    parentTask4.addChildTask(new GanttTaskInfo(10, "User interfaces", new Date(2010, 6, 16), 80, 10, ""));
    parentTask2.addChildTask(parentTask4);
    parentTask2.addChildTask(new GanttTaskInfo(11, "Testing, QA", new Date(2010, 6, 21), 60, 100, "6"));
    parentTask2.addChildTask(new GanttTaskInfo(12, "Task B (Jim)", new Date(2010, 6, 8), 110, 1, "14"));
    parentTask2.addChildTask(new GanttTaskInfo(14, "Task A", new Date(2010, 6, 7), 8, 10, ""));
    parentTask2.addChildTask(new GanttTaskInfo(15, "Task C", new Date(2010, 6, 9), 110, 90, "14"));
    project1.addTask(parentTask1);
    project1.addTask(parentTask2);
    //project 2
    var project2 = new GanttProjectInfo(2, "Web Design", new Date(2010, 5, 17));
    var parentTask22 = new GanttTaskInfo(62, "Fill HTML pages", new Date(2010, 5, 17), 157, 50, "");
    parentTask22.addChildTask(new GanttTaskInfo(63, "Cut images", new Date(2010, 5, 22), 78, 40, ""));
    parentTask22.addChildTask(new GanttTaskInfo(64, "Manage CSS", null, 90, 90, ""));
    project2.addTask(parentTask22);
    var parentTask70 = new GanttTaskInfo(70, "PHP coding", new Date(2010, 5, 18), 120, 10, "");
    parentTask70.addChildTask(new GanttTaskInfo(71, "Purchase D control", new Date(2010, 5, 18), 50, 0, ""));
    project2.addTask(parentTask70);
    // Create Gantt control
    var ganttChartControl = new GanttChart();
    // Setup paths and behavior
    ganttChartControl.setImagePath("./dhtmlxGantt/codebase/imgs/");
    ganttChartControl.setEditable(true);
    ganttChartControl.showTreePanel(true);
    ganttChartControl.showContextMenu(true);
    ganttChartControl.showDescTask(true,'d,s-f');
    ganttChartControl.showDescProject(true,'n,d');
    // Load data structure        
    ganttChartControl.addProject(project1);
    ganttChartControl.addProject(project2);
    // Build control on the page
    ganttChartControl.create(htmlDiv1);
}
/*]]>*/
</script>



    <div style="width:950px; height:620px; position:relative;" id="GanttDiv"></div>
        </body>
    </html>

Can some one help me?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

小矜持 2024-11-25 15:54:35

您是否在某处调用 createChartControl 函数?我在代码中没有看到它。 添加: 。

<script type='text/javascript'>
createChartControl('GanttDiv');
</script>

尝试在定义函数和 div 之后

Are you calling the createChartControl function somewhere? I don't see it in the code. Try adding:

<script type='text/javascript'>
createChartControl('GanttDiv');
</script>

after you define the function and the div.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文