jQuery UI Widgets › Forums › Scheduler › Rebind data > selected date today
Tagged: angular scheduler, angular2 scheduler, bootstrap scheduler, javascript scheduler, jquery scheduler, jqwidgets scheduler, jqxScheduler, Rebind data > selected date today, typescript scheduler
This topic contains 10 replies, has 3 voices, and was last updated by hf 7 years, 8 months ago.
-
Author
-
I would like to refresh the schedules (remote) data when the dateChange event is fired (so I don’t need to call all data at once). Because there’s no refresh method, it could be achieved by setting the source again (http://www.jqwidgets.com/community/topic/refresh-schedule/#post-79630).
This works fine, but the selected date in the calendar jumps back to todays date.
$("#SchedulePersons").on('dateChange', function (event) { var args = event.args; var date = args.date; var from = args.from; var to = args.to; ScheduleFrom = new $.jqx.date(from).toString(); ScheduleTo = new $.jqx.date(to).toString(); var ShowAll = (getCookie('ShowAll') == "true"); var AdapterSchedulePersons = GetAppointments(ShowAll); $("#SchedulePersons").jqxScheduler({ source: AdapterSchedulePersons }); }
I tried to set the calendars date manually after setting the source, but that didn’t worked out.
var CalendarId = $("[id^=calendarjqxWidget]")[0].id; $("#" + CalendarId).jqxCalendar('setDate', new Date(2017, 5, 10));
Hello hf,
Could you try on this way:
$("#scheduler").jqxScheduler({ date: new $.jqx.date(yyyy, MM, dd) })
Hope this help.
Best Regards,
Hristo HristovjQWidgets team
http://www.jqwidgets.comHi Hristo,
It doesn’t make a difference.
$("#SchedulePersons").on('dateChange', function (event) { // is not functioning correct in IE; mixes end and start. var args = event.args; var date = args.date; var from = args.from; var to = args.to; ScheduleFrom = new $.jqx.date(from).toString(); ScheduleTo = new $.jqx.date(to).toString(); var ShowAll = (getCookie('ShowAll') == "true"); var AdapterSchedulePersons = GetAppointments(ShowAll); $("#SchedulePersons").jqxScheduler({ source: AdapterSchedulePersons }); $("#SchedulePersons").jqxScheduler({ date: date }) });
By the way.. I was expecting by setting the date property in the dateChange event would cause a never ending loop, but it didn’t.
Hey hf, just an idea, bind to the bindingComplete event of the Scheduler and set the current date there.
Best Regards,
Peter StoevjQWidgets Team
http://www.jqwidgets.comHi Peter,
Same result.. Shows the correct data in the schedule and displays the correct date above the schedule but still todays date selected in the calendar.
The awkward thing about this, that when I want to go back to todays date.. I can’t select it in the calendar cause it’s already selected.
$('#SchedulePersons').on('bindingComplete', function (event) { $("#SchedulePersons").jqxScheduler({ date: new $.jqx.date(2017, 1, 11) }) });
Hi hf,
Setting the Scheduler’s date property navigates the Scheduler view and does not affect the calendar in the toolbar.
Best Regards,
Peter StoevjQWidgets Team
http://www.jqwidgets.comHi Peter,
So when I use the calendar or the next/prev buttons it affects the calendar AND the schedule. But when I set the date property it only affects the schedule. Would it not be more logical, that the date is selected when navigating through the scheduler?
Is there another way to set the selected date in the calendar on dateChange?
Hi hf,
Yes, it would be more logical to have this behavior in the Scheduler. As a workaround with a non-public/internal API, use the navigateTo method and pass a jqx.date object to it.
Best Regards,
Peter StoevjQWidgets Team
http://www.jqwidgets.comHi Peter,
Thanks for your quick response. The navigateTo method triggers the dateChange so I can’t use the method in dateChange and bindingComplete events, because that causes an endless loop..
Hi hf,
I see no problem to use it inside the bindingComplete and of course it will trigger dateChange. If necessary, you can use boolean flags.
Best Regards,
Peter StoevjQWidgets Team
http://www.jqwidgets.comIndeed, only a matter of boolean 🙂 Thnx, works like a charm!
-
AuthorPosts
You must be logged in to reply to this topic.