Our state of the art Gantt chart


Post by raju1 »

Hi,

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
terminalsDisplay.png (65.71 KiB) Viewed 1335 times

Thanks
Nagaraju


Post by pmiklashevich »

Hello Nagaraju,

You want to have only End-to-Start dependency type. It is not supported out of the box. We have a feature request: https://github.com/bryntum/support/issues/2230

Meanwhile you can override showTerminals 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
Снимок экрана 2021-02-02 в 12.37.38.png (51.37 KiB) Viewed 1322 times

If you want also to restrict dependency type in Task Editor, please see workaround here: viewtopic.php?p=81476#p81476

Best regards,
Pavel

Pavlo Miklashevych
Sr. Frontend Developer


Post by raju1 »

Excellent Pavel, It's working fine.


Post by raju1 »

Hi,

After upgrading to the latest bryntum version, we get an error utilizing the above code when performing the following steps:

  1. Task Resize a task and immediately move the cursor away (the terminals still appear)
  2. Connect any dependency to this task and it will cause an error since "left" does not exist.

We get an error in the following umd js line:

(_data$timeSpanElement = data.timeSpanElement) === null || _data$timeSpanElement === void 0 ? void 0 : _data$timeSpanElement.querySelector(.b-sch-terminal[data-side=${toSide}]).classList.add('b-sch-terminal-active', validityCls);

Here

$timeSpanElement.querySelector(.b-sch-terminal[data-side=${toSide}])

returns as undefined since 'left' terminal does not exist.

Is it possible to prevent the terminals from showing on task resize or any other method?

Thanks,
Nagaraju


Post by alex.l »

Hi Nagaraju,

We have only general flag to manage this https://bryntum.com/docs/gantt/#Scheduler/feature/mixin/DependencyCreation#config-allowCreate

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.

All the best,
Alex


Post by rayudu.pasumarthy »

Hi,

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.

Thanks,
Rayudu.


Post by mats »

Can you please share a short view of what you see?


Post by rayudu.pasumarthy »

Sure Mats,

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
bryntum_terminals.png (156.51 KiB) Viewed 1087 times

Thanks,
Rayudu.


Post by mats »

Sorry, I meant short video (I'm unable to see your problem sorry)


Post by rayudu.pasumarthy »

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).

resize_does_not_remove_terminals.mp4
(474 KiB) Downloaded 58 times

Thanks,
Rayudu.


Post Reply