Hi Tim,
Greetings from Syncfusion support.
We can achieve your query by filtering the records with duration equal to 0 before rendering them. This way, only the milestone records will be imported to XML. We have made use of a loop to go through all the data in the data source and filter out only the records with duration 0. The following code snippets demonstrate the solution.
Index.js
|
var ganttChart = new ej.gantt.Gantt({
dataSource: milestones(),
taskFields: {
id: 'TaskID',
name: 'TaskName',
startDate: 'StartDate',
endDate: 'EndDate',
duration: 'Duration',
progress: 'Progress',
dependency: 'Predecessor',
parentId: 'parentID',
baselineStartDate: 'BaselineStartDate',
baselineEndDate: 'BaselineEndDate',
notes: 'Notes'
},
…
});
ganttChart.appendTo('#Default');
|
|
function milestones() {
var milestone = [];
for (var i = 0; i < GanttData.length; i++) {
if (GanttData[i].Duration == 0) {
var task = {};
task.TaskID = GanttData[i].TaskID;
task.TaskName = GanttData[i].TaskName;
task.StartDate = GanttData[i].StartDate;
task.Duration = GanttData[i].Duration;
task.Progress = GanttData[i].Progress;
milestone.push(task);
}
}
return milestone;
}
|
Note: The work-around we have shared works only for self-referential data and not for Hierarchical data.
Please contact us if you require any further assistance.
Regards,
Monisha.