我使用jquery插件创建一个名为Jquery.Gantt的甘特图我想加载一个json文件,但不幸的是它没有加载。这是json文件的内容。它通过ajax加载json文件,但它不会渲染。
[
{
"name": "WORK IN PROGRESS (WIP) MEETING",
"desc": ""
},{
"name":"",
"desc": "WIP Meeting",
"by": "TEST DATA",
"values": [{
"from": "/Date(2013/05/22)/",
"to": "/Date(2013/05/22)/",
"customClass": "ganttGreen"
},{
"from": "/Date(2013/06/05)/",
"to": "/Date(2013/06/05)/",
"customClass": "ganttGreen"
},{
"from": "/Date(2013/06/19)/",
"to": "/Date(2013/06/19)/",
"customClass": "ganttGreen"
},{
"from": "/Date(2013/07/03)/",
"to": "/Date(2013/07/03)/",
"customClass": "ganttGreen"
},{
"from": "/Date(2013/07/17)/",
"to": "/Date(2013/07/17)/",
"customClass": "ganttGreen"
},{
"from": "/Date(2013/07/31)/",
"to": "/Date(2013/07/31)/",
"customClass": "ganttGreen"
},{
"from": "/Date(August 7, 2013)/",
"to": "/Date(August 7, 2013)/",
"customClass": "ganttGreen"
},{
"from": "/Date(August 14, 2013)/",
"to": "/Date(August 14, 2013)/",
"customClass": "ganttGreen"
},{
"from": "/Date(August 21, 2013)/",
"to": "/Date(August 21, 2013)/",
"customClass": "ganttGreen"
},{
"from": "/Date(August 28, 2013)/",
"to": "/Date(August 28, 2013)/",
"customClass": "ganttGreen"
}]
},{
"name": "OVERALL EVENT COSTINGS",
"desc": ""
},{
"name": "a) Budget",
"desc": "Submission of preliminary budget",
"by": "TEST DATA"
},{
"name": "a) Budget",
"desc": "Submission of revised budget",
"by": "TEST DATA"
},{
"name": "",
"desc": "Confirmation and Sign-off of Budget",
"by": "TEST DATA ",
"values": [{
"from": "/Date(July 1, 2013)/",
"to": "/Date(July 7, 2013)/",
"customClass": "ganttRed"
}]
},{
"name": "",
"desc": "Billing of Deposits and Invoices",
"by": "TEST DATA",
"values": [{
"from": "/Date(July 1, 2013)/",
"to": "/Date(July 7, 2013)/",
"customClass": "ganttRed"
}]
},{
"name": "",
"desc": "Submission of final budget",
"by": "TEST DATA",
"values": [{
"from": "/Date(August 5, 2013)/",
"to": "/Date(August 18, 2013)/",
"customClass": "ganttRed"
}]
},{
"name": "",
"desc": "Confirmation and Sign-off of Final Budget",
"by": "TEST DATA",
"values": [{
"from": "/Date(August 12, 2013)/",
"to": "/Date(August 27, 2013)/",
"customClass": "ganttRed"
}]
},{
"name": "",
"desc": "Billing of Balance payments Invoices",
"by": "TEST DATA",
"values": [{
"from": "/Date(September 9, 2013)/",
"to": "/Date(September 15, 2013)/",
"customClass": "ganttRed"
}]
},{
"name":"EVENT CONCEPT, ID and TAGLINE"
},{
"name":"a) Event Concept based on revised event ID and tagline",
"desc":"Propose / Initial Event Concept",
"by":"TEST DATA",
"values": [{
"from": "/Date(April 1, 2013)/",
"to": "/Date(April 7, 2013)/",
"customClass": "ganttRed"
}]
},{
"name":"",
"desc":"Revise Event Concept based on feedback",
"by":"TEST DATA",
"values": [{
"from": "/Date(May 6, 2013)/",
"to": "/Date(May 12, 2013)/",
"customClass": "ganttRed"
}]
},{
"name":"",
"desc":"Confirmation on Event Concept",
"by":"TEST DATA",
"values": [{
"from": "/Date(May 20, 2013)/",
"to": "/Date(May 26, 2013)/",
"customClass": "ganttRed"
}]
}
]

这是我激活插件的代码。
$(".gantt-chart").gantt({
itemsPerPage: 15,
source: "../../public/js/gantt-sample.json",
scale: "days",
minScale: "days",
maxScale: "months",
navigate: "scroll",
onItemClick: function(data) {
console.log("Item clicked - show some details");
},
onAddClick: function(dt, rowId) {
console.log("Empty space clicked - add an item!");
},
onRender: function() {
console.log("chart rendered");
}
});

答案 0 :(得分:0)
显然我必须使用Jquery 2.我使用的是jquery 1.10.x。