Our pure JavaScript Scheduler component


Post by zhouhu »

Hi,

When I use multiple scheduler instances in Salesforce LWC, I only can work on the last initialised instance.
Please check the screen-shot video in this link https://gofile.io/d/175rR5 for details.

Thank you for your help.


Post by Maxim Gorkovsky »

Hello.
This is a known limitation of the experimental support, please see Sharing static resource between Lightning Web Components section in the salesforce demo guide located at examples/salesforce/src/lwc/README.md:

When the JS bundle is loaded as a static resource it adds a global object called bryntum, where it creates product-specific namespace (gantt in our case). After the init call the bundle starts to use the passed element as the target (root) for popups as described above. It means if you create two components sharing the static resource, bundle will use last element passed to the init() call. So last loaded component would be a target for popups and key events, meaning some features (like key navigation) will break. We are looking for a proper solution to this problem.

In case you use components on different pages of the application you could use navigation API to update root each time:

import { LightningElement, wire } from 'lwc';
import { CurrentPageReference } from 'lightning/navigation';

export default class Gantt_component extends LightningElement {
@wire(CurrentPageReference)
currentPageReferenceCallback(pageRef) {
if (this._loaded) {
bryntum.gantt.init(this.template);
}
}
}

Idea is to call init on the LWC which becomes active. You can try either aura navigation events or smth like pointerover on the main element.

Guide also mentions another possible workaround for this issue.


Post by zhouhu »

Thank you Maxim.

I should read the README first :D


Post by Maxim Gorkovsky »

:)


Post Reply