Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

How to reinit scheduler #47

Open
akvaliya opened this issue Oct 18, 2019 · 1 comment
Open

How to reinit scheduler #47

akvaliya opened this issue Oct 18, 2019 · 1 comment

Comments

@akvaliya
Copy link

What is the best way to reinitialize scheduler.

I have app which supports multi-language. When language localization data doesn't apply to light-box action buttons until scheduler's init method called again.

If i do that then in mobile devices on double tap with details_on_create, it created multiple entries. Like if scheduler is initialize twice then it creates double entries on double tap.

scheduler.skin = "material";
scheduler.config.responsive_lightbox = true;
scheduler.config.touch = true;
scheduler.config.first_hour = 4;
scheduler.config.details_on_create = true;
scheduler.config.lightbox.sections = [
    { name: "description", height: 43, map_to: "text", type: "textarea", focus: true },
    { name: "time", height: 72, type: "time", map_to: "auto" }
];
this.translationToolsData.currentTransToolsObj.subscribe(translationObj => {
    this.translationObj = translationObj;
    if (this.translationObj) {
        scheduler.locale = {
          labels: {
                dhx_cal_today_button: this.translationObj.dhx_cal_today_button,
                day_tab:this.translationObj.schedulerday,
                week_tab:this.translationObj.schedulerweek
             }
        }
        scheduler.init(this.schedulerContainer.nativeElement, new Date(), "week");
        scheduler.setCurrentView();
    }
}); 

@segemun
Copy link

segemun commented Dec 9, 2019

You should reset event listeners on the scheduler container before new initialization.
Something like that:
$('#scheduler-container').replaceWith($('#scheduler-container').clone());
scheduler.init(...)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants