我的页面上有一个 Angular 甘特图。 plunkr 附在这里。
我面临的问题是,当我在不同的里程碑下有同名的不同任务时,我将该任务视为一个单独的里程碑。如果您看到上面的 plunkr,那么您可以看到任务 14
是 milestone 1
和 milestone 2
下具有相同名称的任务,但日期范围不同,但仍然
我将里程碑之外的任务 14 视为新的里程碑。非常感谢对此的任何帮助。
最佳答案
我发现您已使用 children
数组将父里程碑与其任务关联起来。我们可以反向操作来解决您的问题。
只需将子任务与其父任务相关联即可。在子任务中使用 parent
字段。
$scope.data = [
{
name: 'Milestone 1', //name of milestone
//tasks inside this milestone
content: '<i class="fa fa-map-marker" ng-click="scope.handleRowIconClick(row.model)"></i> {{row.model.name}}' // no need to send this from backend
},
{
parent: 'Milestone 1', name: 'Task 11', tooltips: true, tasks: [
{
id: 'work_111', //id of task 11
name: 'Work 111', // display name for this task
color: '#a61229', //the time color for this task
from: '2017-05-01T00:00:00', //start date, it must be a timestamp
to: '2017-05-31T23:59:00' //end date, it must be a timestamp
}
]
}];
请参阅解决您问题的工作plunkr。 WORKING PLUNKR
关于javascript - 相同的子任务在 Angular 甘特图中显示为里程碑,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/44157786/