Premium support for our pure JavaScript UI components


Post by Qwerty »

I reproduced this on the Advanced demo, by replacing

new Gantt({

with

const gantt = new Gantt({

and appending this code snippet to the bottom:

['baselines', 'criticalPaths', 'dependencies'].map((feature) => {
  gantt.features[feature].on({
    enable: () => console.log('Feature enabled', feature),
    disable: () => console.log('Feature disabled', feature)
  });
});

The console logs work correctly for criticalPaths and dependencies, but not for baselines.

We are in the process of upgrading our Gantt version - we are currently implementing version 4.2.6. This seemed to work on the previous version we were using, but not 4.2.6.

Please let me know if I got anything wrong here or if you need any more info.


Post by Maxim Gorkovsky »

Reproduced, ticket opened here: https://github.com/bryntum/support/issues/3563 Thank you for detailed report!


Post by Qwerty »

Thanks. In the meantime, is there any possible workaround we could use?


Post by Maxim Gorkovsky »

Try this one:

import Override from 'lib/Core/mixin/Override.js';
import Baselines from 'lib/Gantt/feature/Baselines.js';

Override.apply(class {
    static get target() {
        return {
            class : Baselines
        };
    }

    addListener() {
        let p = this;

        while ((p = Object.getPrototypeOf(p))) {
            if (!(p._overridden && 'addListener' in p._overridden) && Object.prototype.hasOwnProperty.call(p, 'addListener')) {
                return p.addListener.apply(this, arguments);
            }
        }
    }
});

It traverses prototype chain and looks for original addListener method. Make sure to remove this override once you upgrade to next release.


Post Reply