jsganttライブラリを使用して、Web ページにガント チャートを作成しています。問題は次のとおりです。
バリアント 1 は機能していませんが、バリアント 2 は機能しています。アラート「Start」は表示されますが、アラート「Fin」は関数内に表示されませんcreateChartControl
。そのため、バリアント 1 が機能しない (つまり、空の DIV コンテナー) 理由を理解できず、Firebug はエラー メッセージを表示しません。どんな助けでも大歓迎です。
バリエーション 1:
<script>
function createChartControl(htmlDiv)
{
alert("Start");
var g = new JSGantt.GanttChart('g',document.getElementById(htmlDiv), 'hour');
g.setShowRes(1); // Show/Hide Responsible (0/1)
g.setShowDur(1); // Show/Hide Duration (0/1)
g.setShowComp(1); // Show/Hide % Complete(0/1)
g.setCaptionType('Resource'); // Set to Show Caption (None,Caption,Resource,Duration,Complete)
g.setFormatArr("hours","minutes")
if( g ) {
// Parameters (pID, pName, pStart, pEnd, pColor, pLink, pMile, pRes, pComp, pGroup, pParent, pOpen)
// You can also use the XML file parser JSGantt.parseXML('project.xml',g)
g.AddTaskItem(new JSGantt.TaskItem(1, 'Add minutes/hours', '', '', 'ff0000', 'http://help.com', 0, 'Ilan', 0, 1, 0, 1));
g.AddTaskItem(new JSGantt.TaskItem(11, 'Add support for half days', '5/14/2009 14:00', '5/14/2009 15:30', 'ff00ff', 'http://www.jsgantt.com', 0, 'Ilan', 100, 0, 1, 1));
g.AddTaskItem(new JSGantt.TaskItem(12, 'Add minute view', '5/14/2009 16:00', '5/14/2009 17:00', '00ff00', '', 0, 'Ilan', 40, 0, 1, 1));
g.AddTaskItem(new JSGantt.TaskItem(13, 'Add hours view', '5/14/2009 16:00', '5/14/2009 17:00', '00ffff', 'http://www.yahoo.com', 0, 'Ilan', 60, 0, 1, 1));
g.AddTaskItem(new JSGantt.TaskItem(14, 'Add support for format options', '5/14/2009 18:00', '5/14/2009 19:00', '00ffff', 'http://www.yahoo.com', 0, 'Shlomy', 60, 0, 14, 1));
g.Draw();
g.DrawDependencies();
alert("Fin");
}
else
{
alert("not defined");
}
}
</script>
<script>
$(document).ready(function() {
createChartControl('schedule');
});
</script>
<div style="position:relative" class="gantt" id="schedule"></div>
バリアント 2:
<div style="position:relative" class="gantt" id="schedule"></div>
<script>
var g = new JSGantt.GanttChart('g',document.getElementById('schedule'), 'hour');
g.setShowRes(1); // Show/Hide Responsible (0/1)
g.setShowDur(1); // Show/Hide Duration (0/1)
g.setShowComp(1); // Show/Hide % Complete(0/1)
g.setCaptionType('Resource'); // Set to Show Caption (None,Caption,Resource,Duration,Complete)
g.setFormatArr("hours","minutes")
if( g ) {
// Parameters (pID, pName, pStart, pEnd, pColor, pLink, pMile, pRes, pComp, pGroup, pParent, pOpen)
// You can also use the XML file parser JSGantt.parseXML('project.xml',g)
g.AddTaskItem(new JSGantt.TaskItem(1, 'Add minutes/hours', '', '', 'ff0000', 'http://help.com', 0, 'Ilan', 0, 1, 0, 1));
g.AddTaskItem(new JSGantt.TaskItem(11, 'Add support for half days', '5/14/2009 14:00', '5/14/2009 15:30', 'ff00ff', 'http://www.jsgantt.com', 0, 'Ilan', 100, 0, 1, 1));
g.AddTaskItem(new JSGantt.TaskItem(12, 'Add minute view', '5/14/2009 16:00', '5/14/2009 17:00', '00ff00', '', 0, 'Ilan', 40, 0, 1, 1));
g.AddTaskItem(new JSGantt.TaskItem(13, 'Add hours view', '5/14/2009 16:00', '5/14/2009 17:00', '00ffff', 'http://www.yahoo.com', 0, 'Ilan', 60, 0, 1, 1));
g.AddTaskItem(new JSGantt.TaskItem(14, 'Add support for format options', '5/14/2009 18:00', '5/14/2009 19:00', '00ffff', 'http://www.yahoo.com', 0, 'Shlomy', 60, 0, 14, 1));
g.Draw();
g.DrawDependencies();
}
else
{
alert("not defined");
}
</script>
更新 1: createChartControl 関数内でdhtmlxGanttライブラリを使用してチャートを作成したときに、バリアント 1 が機能していたと言うべきです。
更新 2:バリアント 1 のサンプル コードを更新しました。それでも動作しません。つまり、アラート "Start" が表示され、アラート "Fin" は表示されません。