I want to display the terminals on below scenarios.
When i hover the task right terminal should be visible, left terminal should be hide.
When i creating a dependency for one task to another task in that time other task(To Task) left terminal should be visible and right terminal should be hide.
Please provide the code samples or working examples?
terminalsDisplay.png (65.71 KiB) Viewed 1339 times
Meanwhile you can overrideshowTerminals function of the DependencyCreation mixin, which shows dependency terminals for specified terminalSides. For example:
import Override from '../../lib/Core/mixin/Override.js';
import Dependencies from '../../lib/Gantt/feature/Dependencies.js';
class DependencyCreationOverride {
static get target() {
return {
class : Dependencies,
product : 'gantt',
minVersion : '4.0',
maxVersion : '5.0'
};
}
showTerminals(timeSpanRecord, element) {
const me = this;
if (!me.isCreateAllowed) {
return;
}
if (!me.creationData || me.creationData.source === timeSpanRecord) {
me.terminalSides = ['right'];
}
else {
me.terminalSides = ['left'];
}
me._overridden.showTerminals.call(me, timeSpanRecord, element);
}
}
Override.apply(DependencyCreationOverride);
Снимок экрана 2021-02-02 в 12.37.38.png (51.37 KiB) Viewed 1326 times
If you want also to restrict dependency type in Task Editor, please see workaround here: viewtopic.php?p=81476#p81476
Is it possible to prevent the terminals from showing on task resize or any other method?
I cannot reproduce the problem in our examples, could you?
I see terminals shown only on hover, but disappeared when I started drag-resize.
If it caused because of your overrides, you could use module bundle to reproduce it and see the source code to extend your override and handle that. As far as I see, it is the same class that Pavel suggested you to check, but onOverNewTargetWhileCreating method.
We too have been facing the same issue. We have reproduced the terminals appearing after task resizing on the advanced gantt example (https://www.bryntum.com/examples/gantt/advanced/). We have also sent a RootCause feedback on the same.
We have added the below code to override onOverNewTargetWhileCreating:
import { DependencyStore } from '@bryntum/gantt/gantt.umd.js';
import { GameplanSettings } from 'bryntum_lib/config/configuration.json';
export class DependencyStoreOverride {
public static dependencyInfo: any;
static get target() {
return {
class: DependencyStore,
product: 'gantt'
};
}
onOverNewTargetWhileCreating(target, overEventRecord) {
console.log("Entered Overriden NewTarget");
// @ts-ignore
this._overridden.isValidDependency.call(this, target, overEventRecord);
}
isValidDependency(dependencyOrFromId, toId, type) {
if ( type != GameplanSettings.DependencyType.FinishToStart || dependencyOrFromId == null || toId == null ) {
return false;
}
// @ts-ignore
const result = this._overridden.isValidDependency.call(this, dependencyOrFromId, toId, type);
return result;
}
}
But this does not hit the overriden function.
Could you please let us know how to prevent the terminals appearing on task resize or the updated function to override onOverNewTargetWhileCreating.
Resizing task 'Install Apache' by 3+ days and immediately move the cursor to the right. The terminals will continue to display even when hovering over other tasks. The terminals get removed only when hovering back to 'Install Apache' and out.
bryntum_terminals.png (156.51 KiB) Viewed 1091 times
Sure Mats, below is the video of the terminals appearing after task resize. (Resize the task, leave the mouse button and immediately move the cursor to the right).