Problem/Motivation
The calendar table display refreshes on any ajax update causing the calendar to jump to the current date or initial state. This is bad because if the user jumps between months they get pulled back to the initial (or current) month.
Steps to reproduce
Create a calendar view of any type. Visit page. Trigger any ajax task on the page. (Or let a module do recurring ajax calls)
- In my case I have the Simple less module and the private message module installed. Simple less has a live CSS refresh functionality which is kicking in ajax calls every 1 second. With that module active the calendar jumped back every second, when I close it there is also the private messages module which has a block for notifications that pulls ajax data every 10 seconds if there is a new message. So thats how I knew that this issue was triggered by an ajax call.
Proposed resolution
I'm not that much of an expert but I think; in the js/fullcalendar_view.js on line 367 there is a function that is called after ajaxComplete(). Since there are lots of things using ajax it would be best to restrict those functions to specific ajax events made by the calendar somehow.
| Comment | File | Size | Author |
|---|---|---|---|
| #19 | Screen Recording 2025-09-15 145311.mp4 | 559.7 KB | jmoreira |
| #11 | fullcalendar_retain_data_view-3323399-11.patch | 1.9 KB | bryanmanalo |
Issue fork fullcalendar_view-3323399
Show commands
Start within a Git clone of the project using the version control instructions.
Or, if you do not have SSH keys set up on git.drupalcode.org:
Comments
Comment #2
kozakmaly commentedI can confirm this is an issue, before looking at this issue, the trail led me to this exact same block of code.
Comment #3
mingsongDo you still come across this issue with 5.1.11?
If so, what error / waring message in your Drupal log or in your browser console?
What version of Drupal core are you using?
Comment #4
shabana.navas commentedYes, I'm running the latest version and am getting the same issue.
Comment #5
shabana.navas commentedNevermind, that was due to custom code on my side.
Comment #6
mingsongComment #7
ecdani commentedThis is still an issue, the module intercepts any jquery ajaxComplete event and resets the calendar.
Im using Drupal 10.2.7 and Fullcalendar_view 5.1.13. It doesn't show any error message or similar.
I think that this is a side effect of an intentional behavior.
The line 396 of js/fullcalendar_view.js intercepts every ajax call (related or not to the calendar), and destroys and recreates the calendar, resetting the navigation.
¿There are any potential solution or workaround?
Ty.
Comment #9
alan ridgway commentedI made a change in the fork here to try and ensure that the only ajax that changes the calendar view comes from views ajax. I don't think it covers the entirety of the need here considering other views on the page sending ajax requests will still reload the calendar, but it's a start!
Comment #11
bryanmanalo commentedAdded a patch to store the default date and view before any ajax call. Then reload those values on calendar rebuild/ajax complete.
Visually speaking, the redraw is not noticeable.
Comment #12
mingsongFrom what I see, we got two proposed approaches so far.
@bryanmanalo, could you please create a new fork for your patch? We need the CI tests to make sure new changes won't create a regression bug.
If someone could create a new JavaScript functional test to reproduce this issue with CI, that would be great.
Comment #14
jmoreira commentedPatch #11 worked great for me.
Comment #15
mingsongThe automated test failed.
Back to need work.
Comment #16
mingsongComment #17
jmoreira commentedTests added and passing. Patch still works on my site.
Comment #18
mingsongPlease try the 5.3.x
This issue has been tested with that branch, it looks good to me.
Comment #19
jmoreira commentedTested with 5.3:
- I've imported the test View and tested it without the patch: it goes back to current month.
- Works fine with the patch.
Comment #20
mingsongPatched with 5.3.x.