Schedule_from_end was set successfully but did not take effect

1.Example of using Gantt chart 20_backwards_scheduling
2.schedule_from_end switches from true to false is successfully set

3.schedule_from_end switches from false to true is successfully set.The Gantt chart was not set successfully

version:7.1.5 Pro
https://snippet.dhtmlx.com/2xo42eye

Hello Zhang,
In your demo, you only change the scheduling mode, then you reset the layout configuration that tells Gantt to rebuild the layout. This command is used if you change the layout configuration. After that, Gantt calls the render method to repaint the changes.
The refreshData only repaints tasks, it doesn’t do anything else. And it is not necessary to call that method as Gantt is repainted after the resetLayout method. I would replace those 2 methods with the render method if you only want to repaint tasks:
https://docs.dhtmlx.com/gantt/api__gantt_render.html

If you expect that Gantt will change the task dates after you change the scheduling configuration, Gantt doesn’t work that way. For that, you need to call the autoSchedule method:
https://docs.dhtmlx.com/gantt/api__gantt_autoschedule.html

Also, as the tasks already have constraints, they stay at the same dates when you switch between the scheduling modes. So, you need to remove the asap and alap constraints to reschedule tasks to earlier or later dates.

Here is the updated snippet:
https://snippet.dhtmlx.com/ibyd625o

You can see that with the backward scheduling, some tasks violate the project_end date. This is a bug in Gantt. It will be fixed in the future, but I cannot give you any ETA.

Thank you,
But i find a new question.
In the schedule_from_end=true,when my duration changes, it should bu the start time that is changed instead of the end time
Please look at the examplate:

https://snippet.dhtmlx.com/7iibo8m9

Look at line 88

I use the default way to open the dialog,then modify the duration.
You can see that the end time has been changed
I actually schedule it backwards,expect to change the start time instead of the end time
In practice,this is my own input field instead of the default input field,but the effect is the same.

Hello Zhang,
At the line 88 you only check if Gantt should return the constraint date in the grid column:


So, it is not clear which line you meant.

When you change the task duration, it affects the end_date parameter. This is how Gantt works. But if the task is linked, it will be moved to an earlier date:
https://files.dhtmlx.com/30d/dd640803c090da15b24fa7601a84be2f/vokoscreen-2024-07-02_12-21-54.mp4

If you resize a task or change its duration in the lightbox, the logic here is that Gantt needs to keep the task on the same position. So, Gantt adds the Finish No Later Than constraint. If you don’t want to have this constraint, you can remove it.
For example, you can do that in the onAfterTaskUpdate event handler:

gantt.attachEvent("onAfterTaskUpdate", function (id, task) {
    task.constraint_date = null;
    task.constraint_type = "alap";
    gantt.autoSchedule(id)
});

Here is the updated snippet:
https://snippet.dhtmlx.com/vqwad2ut