[Vtigercrm-developers] Resolved. Re: Problem after using setInterval in Calendar...
Alan Lord
alanslists at gmail.com
Thu May 26 10:11:13 GMT 2022
Thanks to a bit of cluebat from Joe Bordes, I have managed to fix this...
In the renderEvents method of the Vtiger_Calendar_Js library, I had to
add a further call to the Fullcalendar library to remove all sources
from the feed prior to redrawing it., e.g.
Add this line:
>thisInstance.getCalendarViewContainer().fullCalendar('removeEventSources');
just above
> this.getCalendarViewContainer().fullCalendar('addEventSource',
HTH someone else.
Cheers
Al
On 25/05/2022 11:24, Alan Lord wrote:
> Consider this.
>
> You have several users logged into their vtiger 7 system and they are
> regular users of the Shared Calendar. One of my customers wanted the
> calendar to "auto-refresh" so that if another user added an event (all
> shared, public users), within a few seconds other users' calendars would
> redraw and the new item would appear like magic!
>
> So I added a refreshCalendarFeed method to the Calendar class that does
> exactly this every 10 seconds. And it works quite nicely.
>
>> refreshCalendarFeed : function() {
>> var thisInstance = this;
>> if(!thisInstance.intervalId) {
>> thisInstance.intervalId = setInterval( () =>
>> thisInstance.renderEvents(), 10000);
>> }
>> },
>
> Most of the time...
>
> But, if you have had your calendar view open for a few minutes or
> longer, then click the next or previous month navigation buttons, for
> some reason I cannot work out at all, the browser then sends duplicate
> requests for EVERY previous refresh... Even though they are all the same
> (batch mode feed request).
>
> For example, say there had been 20 refreshes over the past few minutes
> on your screen, then you want to look at next month. Click the button
> and the code sends 20 POST requests asking for a batch feed of the
> calendar all with the same parameters etc. This causes everything to
> slow down - obviously - so the calendar doesn't reload for many seconds
> as it is dealing with 20 simultaneous Ajax requests...
>
> Has anyone got any ideas what's going on here?
>
> Cheers
>
> Al
>
> _______________________________________________
> http://www.vtiger.com/
>
More information about the vtigercrm-developers
mailing list