Our state of the art Gantt chart


Post by rodel.ocfemia »

Hi,
When there is a scheduling cycle, I want to automatically remove the dependency record without displaying the popup. I tried the following, the scheduling cycle popup did not show but the sync api was not invoked, then the dependency still visible in the page.

listeners: {
              cycle: ({
                schedulingIssue,
                continueWithResolutionResult,
              }: {
                schedulingIssue: any;
                continueWithResolutionResult: any;
              }) => {
                const resolutions = schedulingIssue.getResolutions();
                const circularDependencies = schedulingIssue.getDependencies();
                // use the 2nd resolution of suggested for inActivation
                resolutions[1].resolve(circularDependencies[0]);
                // I also tried resolutions[0].resolve(circularDependencies[0]), but did not work.
                continueWithResolutionResult('Resume');
                schedulingIssue.collapse();
              },
            }
Dependency-child-to-parent2.PNG
Dependency-child-to-parent2.PNG (33.69 KiB) Viewed 107 times

Testable code:

SchedulingCycle4.zip
(2.24 MiB) Downloaded 13 times

Post by ghulam.ghous »

Hi Rodel,

Just to be clear, you want to remove the dependency right? In that case, you will need to update following line of code inside cycle event:

resolutions[1].resolve(circularDependencies[0]);

to

resolutions[0].resolve(circularDependencies[0]);

Because currently you are deactivating the dependency instead of removing it. Deactivated dependencies are still gonna show on the gantt. Removed dependencies don't.

Screenshot 2024-03-14 at 3.30.32 PM.png
Screenshot 2024-03-14 at 3.30.32 PM.png (109.01 KiB) Viewed 100 times

Regards,
Ghous


Post by rodel.ocfemia »

Hi Ghous,

This code removes the dependency from the UI. But the sync did not trigger automatically. Is there a way for the sync to trigger automatically so that we can also delete the record in the backend?

resolutions[0].resolve(circularDependencies[0]);

Post by ghulam.ghous »

Hi Rodel,

You will have to disable silentInitialCommit config on the project model https://bryntum.com/products/gantt/docs/api/Gantt/model/ProjectModel#config-silenceInitialCommit. We have this config to flush out the changes caused by the project loading. Since removing the cycle is done at the time of project loading and it is flushed and hence no project sync call is triggered.

Regards,
Ghous


Post Reply