Our pure JavaScript Scheduler component


Post by tomerPlanit »

Hi,
I work with scheduler 5.0.6and angular 13.

I am trying to delete/add dependencies after scheduler loaded.
I create some demo on your last dependency demo.
I have one button that remove all dependencies from "Drill 2" resource, and other button that add
dependency in resource "Drill 2" between "NPO879"=>"VBM2x34"

My code:

remove() {
        this.changeDependencies({ delete: ['5To6','6To7','7To8'], add: [] });
    }

add() {
    this.changeDependencies({ delete: [], add: ['5To6'] });
}
// Change dependencies.
private async changeDependencies(changes: { delete: string[], add: string[] }) {
    this.scheduler.dependencyStore.beginBatch();

    // Not need do this for idle view.

    if (changes.delete && changes.delete.length > 0) {
        this.deleteDependencies(changes.delete);
    }
    if (changes.add && changes.add.length > 0) {
        this.addDependencies(changes.add);
    }
    this.scheduler.dependencyStore.endBatch();
    await this.scheduler.dependencyStore.project.commitAsync();
}

// Add dependencies by id.
private addDependencies(ids: string[]) {
    ids.forEach((id: string) => {

        // For know that no such dependency.
        const searchDependency: Model = this.scheduler.dependencyStore.getById(id);
        if (!searchDependency) {
            const newDependency: DependencyModel = this.createDependencyByGivenId(id);
            if (newDependency) {
                this.scheduler.dependencyStore.add(newDependency);
            }
        }
    });
    console.log(this.scheduler.dependencyStore.getRange().map(x=>x.id));
}

// Remove dependencies by ids.
private deleteDependencies(ids: string[]) {
        this.scheduler.dependencyStore.remove(ids,true);
        console.log(this.scheduler.dependencyStore.getRange().map(x=>x.id));
}

private createDependencyByGivenId(id: string): DependencyModel {
    const splitId: string[] = id.split('To');
    if (splitId.length == 2) {
        // @ts-ignore.
        return {
            fromEvent: splitId[0],
            toEvent: splitId[1],
            type: 2,
            id: id,
        };
    }
    return null;
}

After try I can see that no problems inside the store but nothing happened in the DOM

Add demo with my code based on angular dependency demo:

Attachments
dependencies.rar
(288.04 KiB) Downloaded 30 times

Post by marcio »

Hey tomerPlanit,

Thanks for the report and the example, I reproduced here it's indeed a bug. Created a ticket for it: https://github.com/bryntum/support/issues/4887

Best regards,
Márcio


Post by tomerPlanit »

Hey marcio,
How long will this fix take, because it is a mandatory feature in our system.


Post by marcio »

Hey,

Could you please try to use the latest nightly build from Scheduler (you can download that in Bryntum Customer Zone)??

I tested it here and it worked.

Best regards,
Márcio


Post Reply