How to create a new scheduler after calling destroy

I have the problem that when initializing schedulers with different settings on separate pages, that they always conflcit. I can call destroy on the SchedulerStatic, but I can’t find I way to recreate it, without refreshing the page.

Hello @HVossi92,

You can destroy and create a scheduler instances when you’re creating it with the getSchedulerInstance method:
https://docs.dhtmlx.com/scheduler/multiple_per_page.html

Here is an example of Vue code:

  mounted() {
    scheduler = Scheduler.getSchedulerInstance();


...
  unmounted() {
    this.scheduler.destructor();
  },

Kind regards,

Hello Siarhei thank you for your reply,
I am using SchedulerStatic, so I can’t get an instance. I can call the destructor, but then I have to refresh the page to re-initialize the scheduler.
This is what I do:
` onMount(async () => {
if (scheduler) {
scheduler.clearAll();
}
await import(‘$lib/dhtmlx/scheduler/sources/dhtmlxscheduler.js’);
let newScheduler: SchedulerStatic = (window as any).scheduler;
scheduler = configureTimelineScheduler(newScheduler, units) as SchedulerStatic;
scheduler.config.drag_move = isDragAllowed;
scheduler.config.header = null;
scheduler.config.dblclick_create = isDblClickCreateEnabled;
initScheduler($page, addEventHandlers, scheduler);
});

onDestroy(() => {
removeSchedulerEvents(scheduler);
});`

`export function configureTimelineScheduler(scheduler: SchedulerStatic, units: SelectOption[]) {
if (!scheduler) return;
scheduler.plugins({
tooltip: true,
key_nav: true,
cookie: true,
timeline: true,
active_links: true,
treetimeline: false,
daytimeline: true,
minical: true,
url: true,
limit: true,
multisection: true,
multiselect: true,
units: true,
});

scheduler.config.details_on_create = true;

`

So I basically overwrite the scheduler everytime I switch pages, due to different layouts and functionality.

‘Scheduler.getSchedulerInstance is not a function’

We have the individual pro version, which doesn’t seem to support instances. We weren’t aware of that fact, since we do not need multiple instances of the scheduler on the same page, only on different pages. But being a SPA, we have client side navigation. Hence I am basically trying to re-initialize / overwrite hte static scheduler.