Events when clicked each button of today, previous, next

Hi everyone,

I use Timeline view but kindly let me consult with you for having an issue on my end.
https://docs.dhtmlx.com/scheduler/timeline_view.html
I’d like to reload the latest data from database when each button of Today, Previous(arrow) and Next(arrow) were clicked.
onViewChange Event fires after one of those buttons were clicked.

However, the reload method inside onViewChange Event is endlessly called if I added the reload method to call the get api and set its latest data on the timeline view there.
https://docs.dhtmlx.com/scheduler/api__scheduler_onviewchange_event.html
Are there any suitable events at the time those buttons were clicked?
image

▼Currently it’s like as below
Frontend :

scheduler1.attachEvent("onViewChange", async (new_mode , new_date)  => {
    if(new_date !== viewBaseDate) {
        await reloadReservation(new_Date, ...) // call get api inside
    }
});

Thank you for your support as always.

meicom

Hello @meicom ,

The best option for the described requirement is the dynamic loading functionality, that forces scheduler to load data only for displayed date range:
https://docs.dhtmlx.com/scheduler/loading_data.html#dynamicloading

Did you already try it?

Regarding then described issue, as I can see you are using async function inside the onViewChange - it’s not one of the tested scenarios, so it may cause the issue.

Kind regards,