[INFO REQ] Update scheduler toolbar datepicker on other button click
Posted: Sat Apr 24, 2021 8:38 pm
by cubrilo
Hi,
I am using scheduler toolbar and I have datepicker to change the date of scheduler and also buttons next and previous date to navigate the dates. I need to update the datepicker on next or prev button click. I am looking at the documentation for something like scheduler.toolbar.getWidgets() or something similar but can't find anything to access the widgets.
Re: [INFO REQ] Update scheduler toolbar datepicker on other button click
Re: [INFO REQ] Update scheduler toolbar datepicker on other button click
Posted: Thu May 06, 2021 9:34 am
by cubrilo
I actually tried to use that, but I get only the generic Widget calls on the date picker. The only way I manage to change the date is if I do this:
scheduler.tbar.widgetMap['schedulerDatepicker'].input.value = new Date()
and then I have to also take care of the formatting? Isn't there some function which can handle this? Also about the localization, I would like to pass the locale for formatting to the date picker and let it just handle it. Is this possible? Or I must use the locale manager?
Re: [INFO REQ] Update scheduler toolbar datepicker on other button click
Posted: Thu May 06, 2021 10:05 am
by saki
You shouldn't need to go down to the input. The following code illustrates the approach (you can test it in basic scheduler demo):
const scheduler = new Scheduler({
tbar : [{
type : 'date',
text : 'Date Picker',
ref : 'myDatePicker'
}],
// ... etc.
});
setTimeout(() => {
scheduler.tbar.widgetMap.myDatePicker.value = new Date();
}, 2000);
Re: [INFO REQ] Update scheduler toolbar datepicker on other button click
Posted: Fri May 07, 2021 12:58 pm
by cubrilo
I tried in the time ranges demo, by adding the datepicker and updating it on the next button