Dhtmlx 甘特图 - 小问题

发布于 2024-10-10 07:10:36 字数 2350 浏览 9 评论 0原文

我已经设置了 DHTMLX 甘特图 (http://dhtmlx.com/docs/products/dhtmlxGantt/index.shtml)。我正在加载原始 xml 数据而不是 xml 文件。

但是,我收到一条警告,提示“无法解析此 XML 字符串”。但是当我单击“确定”时,甘特图显示正常。

下面是我正在使用的代码:

var $_ = jQuery;
$_(document).ready(function() {
window.createChartControl = function(htmlDiv1){
    var ganttChartControl = new GanttChart();
    ganttChartControl.setImagePath("../../../../lib/plugins/html/gui/dhtmlx/gantt/1.3/codebase/imgs/");

    ganttChartControl.create(htmlDiv1);

    var xml_data_str = '<projects><project id="1" name="Project 1" startdate="2006,12,14"><task id="1"><name>Task 1 of Project 1</name><est>2006,12,14</est><duration>20</duration><percentcompleted>20</percentcompleted><predecessortasks></predecessortasks><childtasks><task id="11"><name>Sub Task 1 of Task 1 of Project 1</name><est>2006,12,14</est><duration>5</duration><percentcompleted>10</percentcompleted><predecessortasks></predecessortasks><childtasks></childtasks></task><task id="12"><name>Sub Task 2 of Task 1 of Project 1</name><est>2006,12,15</est><duration>10</duration><percentcompleted>20</percentcompleted><predecessortasks>11</predecessortasks><childtasks></childtasks></task></childtasks></task></project><project id="2" name="Project 2" startdate="2006,12,17"><task id="2"><name>Task 1 of Project 2</name><est>2006,12,17</est><duration>60</duration><percentcompleted>20</percentcompleted><predecessortasks></predecessortasks><childtasks><task id="21"><name>Sub Task 1 of Task 1 of Project 2</name><est>2006,12,17</est><duration>40</duration><percentcompleted>20</percentcompleted><predecessortasks></predecessortasks><childtasks></childtasks></task></childtasks></task></project></projects>';
    ganttChartControl.loadData(xml_data_str, false, false);
    }

window.createChartControl('chart_dhtmlx_gantt_2');
});

相关位是 XML 数据。是我设置的方式有问题吗?!

请协助。

谢谢。

I've set up DHTMLX Gantt Chart (http://dhtmlx.com/docs/products/dhtmlxGantt/index.shtml). I'm loading raw xml data as opposed to an xml file.

However, I get an alert saying 'Cannot Parse This XML String'. But when I click 'OK' the Gantt Chart appears as normal.

Below is the code I'm working with:

var $_ = jQuery;
$_(document).ready(function() {
window.createChartControl = function(htmlDiv1){
    var ganttChartControl = new GanttChart();
    ganttChartControl.setImagePath("../../../../lib/plugins/html/gui/dhtmlx/gantt/1.3/codebase/imgs/");

    ganttChartControl.create(htmlDiv1);

    var xml_data_str = '<projects><project id="1" name="Project 1" startdate="2006,12,14"><task id="1"><name>Task 1 of Project 1</name><est>2006,12,14</est><duration>20</duration><percentcompleted>20</percentcompleted><predecessortasks></predecessortasks><childtasks><task id="11"><name>Sub Task 1 of Task 1 of Project 1</name><est>2006,12,14</est><duration>5</duration><percentcompleted>10</percentcompleted><predecessortasks></predecessortasks><childtasks></childtasks></task><task id="12"><name>Sub Task 2 of Task 1 of Project 1</name><est>2006,12,15</est><duration>10</duration><percentcompleted>20</percentcompleted><predecessortasks>11</predecessortasks><childtasks></childtasks></task></childtasks></task></project><project id="2" name="Project 2" startdate="2006,12,17"><task id="2"><name>Task 1 of Project 2</name><est>2006,12,17</est><duration>60</duration><percentcompleted>20</percentcompleted><predecessortasks></predecessortasks><childtasks><task id="21"><name>Sub Task 1 of Task 1 of Project 2</name><est>2006,12,17</est><duration>40</duration><percentcompleted>20</percentcompleted><predecessortasks></predecessortasks><childtasks></childtasks></task></childtasks></task></project></projects>';
    ganttChartControl.loadData(xml_data_str, false, false);
    }

window.createChartControl('chart_dhtmlx_gantt_2');
});

The relevant bit is the XML data. Is there something wrong with the way I've set it up?!

Kindly assist.

Thanks.

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

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

发布评论

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

评论(1

一百个冬季 2024-10-17 07:10:36

查看论坛上的这篇文章
http://forum.dhtmlx .com/viewtopic.php?f=15&t=15909&p=48639&hilit=loaddata#p48639

代码中有一个错误...

Check out this post on the forum
http://forum.dhtmlx.com/viewtopic.php?f=15&t=15909&p=48639&hilit=loaddata#p48639

There is a bug in the code ...

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