search envelope-o feed check
Home Unanswered Active Tags New Question
user comment-o

Problems between Infinite Scrolling and Switcher over Scheduler Calendar

Asked by Arturo Villalpando
4 years ago.

Hi everybody,

I have a trouble with the plugin, and I don't know how to fix it. First of all, I implemented Infinite Scrolliing and Switcher to change the view between day and month in a Scheduler Calendar. In this case, the Switcher works for the Scheduler calendar with some problems, because I can't access to onChnage when a Swither is trigger. But well, the problem that I have is at the moment that I change between month and day views, the date for the Scheduler start a step back, for example:

I set “today” date for both calendars, then I switch to month view, and display initial date 7 months back, then I switch to day view and display for initial day 4 months back, change again to month view and display initial date 5 months back from the previous change, and change to day view and the do the same, and go on. If I implement just the switcher without infinite scrolling, this does not happen, I don't know how to control this problem. Do you have any idea?

The other problem is when I reload the webpage, the events load two times, two for the day view and two for the month view, actually I tried to find the way that just called for the actual view, to avoid waste resources. But well, the problem here is that the event loading is called two times and not one for both views, and is a problem from the infinite scrolling again, because when I disable the scrolling the called for the events is happens ones.

I hope that you can help me, sorry for my english and thanks in advanced

Regards

Answer posted by Dan Letecky [DayPilot]
4 years ago.

The Switcher is only necessary if you want to manage different components, e.g. DayPilot.Calendar for the week view and DayPilot.Month for the Month view.

If you are using two different configurations of DayPilot.Scheduler it's better to use a single instance and change its properties when switching the view. This way you can avoid the duplicate data loading and synchronization of the two instances.

You can use the zoom feature to switch between different configurations:
https://code.daypilot.org/32893/javascript-scheduler-zoom

Or you can simply update the properties using an update() call.

Comment posted by Arturo Villalpando
4 years ago.

Hi, thanks Dan Letecky

I implemented the Zoom Feature and works better than Switcher.

Despite that i set startDate to Today() when I changed the zoomLevel with the Scrolling activated, the Schedule continue changed the date to other months, actually the moviment of dates now is forward, even if I Update the Schedule after apply the zoom Level.

Comment posted by Arturo Villalpando
4 years ago.

Hi,

I solved the problem that appeared when implement Scrolling with Zoom features and the dates was move backward or forward when we changed of Zoom:

onScroll: function (args) {
/*
* The next line fix the problem of start with another date that we never set.
* Now the scroll works with change of zoom, fixed the backward and forward of the dates.
* Now when the scroll is moved, the first date is the same that scroll have at begining.
* The lines inside the zoomLevels "startDate and days" doesn't work with the Scroll, you can erase or leave it, maybe one day they fix that problem.
*/
dp.startDate = DayPilot.Date.today().firstDayOfMonth();
// Do something...
},

Comment posted by Dan Letecky [DayPilot]
4 years ago.

Changing startDate in onScroll is not a solution, please see more here:
https://forums.daypilot.org/question/4995/how-to-prevent-the-changed-between-dates-when-we-implemente

This question is more than 1 months old and has been closed. Please create a new question if you have anything to add.