Function auto schedule [React]

Hi Team DHTMLX

I have a button auto-schedule, but I don’t know to implement this button auto-schedule.
I already read the documentation but I have stacked it because in the documentation not use the button.

thank you.

Hello,

One of the options is to attach the click listener on window inside the useEffect method, and run the Gantt functionality from this listener using e.target.closest, as follows:

window.addEventListener('click', function (e) {
    if (e.target.closest(".toolbar")) {
        if (e.target.dataset.action === "auto_scheduling") {
            gantt.config.auto_scheduling = !gantt.config.auto_scheduling;
                if (gantt.config.auto_scheduling) gantt.autoSchedule();
            }
        }
    }
 });

Please check the React demo:
https://files.dhtmlx.com/30d/fbf7f82371af283c4a2ff60a99c39b87/reactive-gantt+auto_schedule_button.zip

Steps to run:
Unzip
Run yarn install
Run yarn start