I was wondering if someone has the same problem as me.

The AJAX mechanism for paging is not working for the block calendar (mini calendar). It's working on the preview but not on the block himself.

I use theses modules:

- Drupal Core 7.10
- Views 7.x-3.0-rc3
- Date 7.x-2.0-alpha5
- Calendar 7.x-3.0-alpha1

CommentFileSizeAuthor
#10 bugpic.png45.63 KBchaky
Support from Acquia helps fund testing for Drupal Acquia logo

Comments

acolyte26’s picture

I am having the exact same problem as well.

Jibus’s picture

Based on the AJAX navigation in month view ticket, it seems that it's a not a bug but mostly a feature request.

Anyway, I managed to add the no-relead page feature, thanks to the solution provided by Architeck (http://drupal.org/node/339279#comment-2006476) which use Jquery.

Below, the code for Drupal 7.

(function ($) {

  Drupal.behaviors.calendar = {
    attach: function(context, settings) {
		{
			$.ajaxSetup ({cache: false});
			// Display animated loading gif during the load event
			var loading = "<center><img class='loading' src='/sites/all/themes/your_theme/images/ajax-loader.gif' alt='loading...' /></center>";
			function nextLoad(){
			// Get the nextURL from the pagers next link
			var nextUrl = $(".date-next a")[0].href; 
			// Identify the content/container you wish to replace
			$(".calendar-calendar .date-next a")
			// Optionnal - Add the loading image
			.html(loading)
			// Optional - remove this if you don't want to add fade effect
			.css({ opacity: 0 }).fadeTo("normal",1)
			// Load the nextUrl + return the specific content by specifing the css class or id + bind the click function tp the newly loaded content
			.load(nextUrl+ ".view-calendar .calendar-calenda", bindClick );
			};
			function prevLoad(){
			var prevUrl = $(".calendar-calendar .date-prev a")[0].href; 
			$(".view-calendar")
			.html(loading)
			.load(prevUrl+ ".view-calendar .calendar-calendar", bindClick );
			};
			function bindClick(){
			$(".date-prev a").click(function(){ 
			prevLoad();
			return false;
			});
			$(".date-next a").click(function(){ 
			nextLoad();
			return false;
			});
			};
			// Append the click function to the on the initial page load
			bindClick();
			}	
    }
  };

})(jQuery);

You may have to adapt these, according to your theme

Of course, this is not very pretty. But for me, it does the job !

KarenS’s picture

Status: Active » Fixed

Ajax paging should work out of the box. It requires two settings in the view. First, you have to set Ajax = yes. Then you have to edit the Date pager and make sure you are using the 'Pager' format. The 'Clean' format will not work in ajax. With those two settings it should work fine with no additional code.

Status: Fixed » Closed (fixed)

Automatically closed -- issue fixed for 2 weeks with no activity.

cesabal’s picture

I use, the pager format, and i have enabled the ajax = yes, but this not work for me

Jibus’s picture

KarenS, i tried your solution, but i still can't get the calendar block ajax to work.

I have to mention that i have override the default template.

capellic’s picture

Status: Closed (fixed) » Active

Same issue over here. When shown in a block on my default events page (/events), the pager works so that I may go the previous or next months with no problems. I can get from the current month (April) to May, June, July etc as well as March, February, etc.

Also, I am able to use the prev/next links when on a page filtered for a day (/events/2012-03-14).

The problem comes in on pages that have the "mini" argument (/events/2012-03-14?mini=2012-03). When clicking the prev/next links, I get the spinner, but then nothing happens. When I hover over the prev/next links, the URL looks good (/events/2012-03-06?mini=2012-04).

KarenS’s picture

Status: Active » Closed (fixed)

If you are using alpha1, as this version says, you need the latest code. Everything is working fine with the latest dev versions of both Date and Calendar so long as you use the 'pager' links and set the view up to use ajax.

If you still have trouble after that you may have some other module or code intefering. If you can't reproduce a bug on a clean install with just Date and Calendar enabled it is likely something else causing the problem.

capellic’s picture

Version: 7.x-3.0-alpha1 » 7.x-3.3
Status: Closed (fixed) » Needs work

@KarenS -

I've upgraded to 3.3, upgraded Date, and I'm still having the problem described in #7.

Thank you.

chaky’s picture

FileSize
45.63 KB

Yah, me as well. When I click on the next on the block, I could go to next month, but after clicking the next again, nothing happens. It's really crazy. When I open the developer console, it says "event.layerX and event.layerY are broken and deprecated in WebKit. They will be removed from the engine in the near future."

BTW, I use Chrome 19 if you need the information.

capellic’s picture

@chaky: From you description, this isn't exactly my case. In my case, I can go forward and back as much as I want until I click on a mini link and then get the mini argument:

The problem comes in on pages that have the "mini" argument (/events/2012-03-14?mini=2012-03). When clicking the prev/next links, I get the spinner, but then nothing happens. When I hover over the prev/next links, the URL looks good (/events/2012-03-06?mini=2012-04).

Can you clarify your use case?

mboeschen’s picture

Same situation as #10. Happens in both Chrome 19 and IE9. And sometimes I get it to display one month before, and then it seems to cache it. So then on every browser I see the previous month, but can't change the month. Once I clear the cache, it goes back to the current month, still can't change. Calendar 7.x-3.4, Date 7.x-2.5, Drupal 7.14

zenlan’s picture

Ignore, my bad!

edit: DOH!!!! I never even noticed that the view, which was created using a "Calendar" template, actually had caching switched on by default! Switched it off and the issue goes away.

ironman67’s picture

When navigating to a previous or next month, ?mini=year-month gets added to the calendar day urls. I found that if I removed the ?mini=year-month parameter from the urls the calendar then functioned properly with no odd side effects. I could not find in the calendar code where the ?mini=... parameter gets applied so I applied some js code instead to resolve the issue. Since the site this was on was using an older jQuery version I used the .live() function rather than .on(). Removes the ?mini= parameter onclick.

var parmchk = new RegExp("\\?mini=\\d{4}-\\d{2}");
jQuery('table.mini td a').live("click", function(){
jQuery(this).attr("href",jQuery(this).attr("href").replace(parmchk,""));
});

capellic’s picture

The JS code discussed in #14 was added to the theme's javascript file.

Anonymous’s picture

I can also confirm that disabling caching corrects all of my woes with Calendar. I'm not referring to site caching, click on "Advanced" link to display the advanced options for the view. Look at the cacheing option, most likely if you see something set there that is the cause of all your problems. Click on it and set it to none. This fixed all the weird problems such as one month being skipped, not being able to go to next or previous months from a certain month ...etc. I was pulling hair and gritting teeth because non of these errors made any sense. I have 4 calendars setup similarly and i was having problems only with the third and fourth calendars. Threw me off completely ... learned my lesson i know from now on when encountering bizarre behavior in drupal or modules the most likely sources are the cache and or ctools. I hope this helps others avoid alot of frustration. Thank you ZenLan for your post.

pramses’s picture

This is true. Most problems come from caching as the view cannot load new values through ajax.
Disabling caching solves the problem but the performance is bad if you have many events.

In my case with 5 events per day the page takes 4x longer to load.

I would be happy if someone could give some ideas to solve this.

marcus178’s picture

As far as I can tell Ajax doesn't work at all on the mini calendar, I have no cache on the view and set as detailed in the post and it just doesn't work.

Immansophia’s picture

Issue summary: View changes

ironman67: Greetings. This refers to item #14. I am having the same issue with regards to the ?mini=some parameter. During testing we found that the calendar loses some dates and does not display properly if the following parameters are appended to the query string.

?mini=12345-12345+2014-05-14

Any help to fix this would be appreciated. I am using Calendar version 7.x-3.4

Thanks,

liborvanek’s picture

This might as well be a problem of overridden views-view.tpl.php.
Try default theme first and then try again with your theme. If the problem occurs in latter only, try reverting to default views-view.tpl.php.

Biswajit Roy’s picture

Same issue I was suffering from. I had enabled "Caching" of views. I able to find that the cache is the issue for calender load using Ajax, so, I have set cache configuration of views to "None", after that it's working.

Cheers,
B. Roy

apaderno’s picture

Version: 7.x-3.3 » 7.x-3.x-dev
Status: Needs work » Active