Open arcady-zherdev opened 1 month ago
A quick workaround is:
// support inherited dependencies on the data level
Ext.define('MyApp.TaskModel', {
extend : 'Gnt.model.Task',
getCriticalPaths: function () {
var toProcess = [this],
cPath = [[this]],
task;
while (task = toProcess.shift()) {
var dependencies = task.getIncomingDependencies(true).concat(task.getParentsIncomingDependencies()),
criticalPredecessors = [];
for (var i = 0; i < dependencies.length; i++) {
var dependency = dependencies[i],
predecessor = dependency.getSourceTask();
if (predecessor.isCritical() && dependency.isCritical(dependency)) {
criticalPredecessors.push(predecessor);
}
}
if (criticalPredecessors.length) {
toProcess = toProcess.concat(criticalPredecessors);
cPath.push(criticalPredecessors);
}
}
return cPath;
}
});
// support inherited dependencies on the UI level
Ext.define('MyApp.GanttViewOverride', {
override : 'Gnt.view.Gantt',
highlightCriticalPaths : function () {
var me = this;
this.callParent(arguments);
var paths = me.getCriticalPaths(),
dependencyStore = me.getDependencyStore(),
dependencyView = me.ownerGrid.getDependencyView();
// we might have multiple projects
Ext.Array.each(paths, function (path) {
var prevLevelTasks = [];
// walk through the path
Ext.Array.each(path, function (levelTasks) {
// every element is an array of critical predecessors
for (var i = 0, l = levelTasks.length; i < l; i++) {
var task = levelTasks[i];
// If we have the previous path chain
// let's loop over its tasks and highlight stressed dependencies
Ext.each(prevLevelTasks, function (prevTask) {
prevTask.bubble(function (parent) {
if (!parent.isRoot() && !parent.isProject) {
var dependency = dependencyStore.getTasksLinkingDependency(task, parent);
dependency && dependencyView.highlightDependency(dependency);
}
});
});
}
prevLevelTasks = levelTasks;
});
});
}
});
Reported here: https://forum.bryntum.com/viewtopic.php?p=148496#p148496
Ext Gantt does not include inherited parent dependencies into critical paths. Sample dataset: