【问题标题】:jQueryGantt - No template found for typejQueryGantt - 找不到类型的模板
【发布时间】:2015-09-17 11:42:52
【问题描述】:
全部,
我已经实现了 jQueryGantt() 但我得到一个错误信息:
找不到类型“TASKSEDITHEAD”的模板
找不到类型“GANTBUTTONS”的模板
我已经在 github 站点和支持站点上进行了搜索,但我找不到解决此问题的方法。有人有想法吗?
否则:有人知道 Bootstrap / jQuery 的良好规划 / 甘特图插件吗?
【问题讨论】:
标签:
jquery
twitter-bootstrap
twitter-bootstrap-3
gantt-chart
【解决方案1】:
问题是它寻找的模板写在“gantt.html”文件中。如果您尝试在自己的页面中使用此库/插件,您还需要包含这些模板。该库不会从 gantt.html 文件中自动加载它们。
我所做的是将带有 id="gantEditorTemplates" 的整个 div 复制到一个新的 html 文件(“templates.html”)中,然后在 javascript 中执行此操作:
var ge = new GanttMaster();
$('<div></div>').appendTo('body')
.load('templates.html', function(response, status, xhr) {
// initialize the gantt only after the templates are loaded
ge.init($("#myGanttContainer"));
});
如果需要,您可以将模板保留在 gantt.html 文件中并像这样加载它们:
$('<div></div>').appendTo('body')
.load('gantt.html #gantEditorTemplates', function(response, status, xhr) {
//[...]
});
根据jQuery's .load() documentation。