This is just to make it easier for people trying to achieve this feature. It has to do with the jQuery library and not the module itself. There is an issue filed for this in the library's queue. I don't take any credit for this code, merely duplicating it here for easier access I have only altered the line numbers to reflect actual ones...

Hi, I have adapted comment #12 to work with FullCalendar 1.5.2. Here's my contribution:

fullcalendar.js

line 3101:

		slotBind(slotTable.find('td'));
		// new header bind
		headerBind(dayHeadCells);

line 3231:

	function slotBind(cells) {
		cells.click(slotClick)
			.mousedown(slotSelectionMousedown);
	}

	function headerBind(days) {
		days.click(headerClick)
			.mousedown(daySelectionMousedown);
	}

	function headerClick(ev) {
		if (!opt('selectable')) { // SelectionManager will worry about dayClick
			var col = Math.min(colCnt-1, Math.floor((ev.pageX - dayTable.offset().left - axisWidth) / colWidth));
			var date = colDate(col);
			var rowMatch = this.parentNode.className.match(/fc-slot(\d+)/); // TODO: maybe use data
			if (rowMatch) {
				var mins = parseInt(rowMatch[1]) * opt('slotMinutes');
				var hours = Math.floor(mins/60);
				date.setHours(hours);
				date.setMinutes(mins%60 + minMinute);
				trigger('headerClick', dayHeadCells[col], date, false, ev);
			}
			else {
				trigger('headerClick', dayHeadCells[col], date, true, ev);
			}
		}
	}

And finally, in your fullCalendar init code you should define the headerClick callback:

	headerClick: function (date, jsEvent, view) {

	// somehow the function 'view' argument has an empty value for "view.name"
	// so I get the view Object from the Calendar before use it.
	var view = $('.fullcalendar').fullCalendar('getView');

	if (view.name == 'agendaWeek') {
		$(".fullcalendar").fullCalendar('gotoDate', date);
		$(".fullcalendar").fullCalendar('changeView', 'agendaDay');
	}

That's all. Hope it helps

Support from Acquia helps fund testing for Drupal Acquia logo

Comments

tim.plunkett’s picture

Status: Active » Fixed
klonos’s picture

...here's a patched 1.5.2 version of fullcalendar.js that includes the headerClick extension (drupal.org renames the file to _.txt, so remove that). I'm also attaching a .diff and a full .zip

I don't know if there's something that needs to be done on the drupal module part though.

Status: Fixed » Closed (fixed)

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

ryantollefson’s picture

I would love to see this option as well. I have tried to use the patched fullcalendar.js, but I think something needs to be changed in the drupal module for it to work.

klonos’s picture

There have been some updates to the bug filed over at http://code.google.com/p/fullcalendar/issues/detail?id=153 Once again: I don't claim any recognition - credits go to the original posters of the solutions at the issue linked previously...

Here is one another and much simpler. If you are working with FullCalendar v1.5.3

just add following:

dayClick: function(date, allDay, jsEvent, view) {
    if(view.name != 'month')
    return;

    $('#calendar').fullCalendar('changeView', 'agendaDay')
    .fullCalendar('gotoDate', date);
  },

in $('#calendar').fullCalendar({ this section

Also for changing mouse pointer when you hover day, add cursor: pointer in

.fc-widget-content {
	border: 1px solid #ccc;
	}

Thats all you need to do.

Hello,

I solved this way, no need to hack into fullcalendar's code:

First define a convenient columnFormat for week's view, so you can read the date (day) to navigate to from it, in my case (for catalan locale):

columnFormat: {
            month: 'ddd',
            week: 'dddd dd/MM/yyyy',
            day: 'dddd dd/MM/yyyy'
        }

Next hook into viewDisplay and add something like:

viewDisplay: function(view) {
            // Add onclick to header columns of weekView to navigate to clicked day on dayView
            $jq('table.fc-agenda-days thead th').each(function(){
                if($jq(this).html() != " "){
                    $jq(this).css('cursor','pointer'); // set cursor
                    $jq(this).unbind('click'); //unbind previously bound 'click'
                    $jq(this).click(function(){
                        var dateStr = $jq(this).html().substring($jq(this).html().indexOf(' ')+1);
                        var day = dateStr.substring(0, 2);
                        var month = dateStr.substring(3, 5) - 1;
                        var year = dateStr.substring(6, 10);
                        $jq('#calendar').fullCalendar('gotoDate', new Date(year, month, day));
                        $jq('#calendar').fullCalendar('changeView', 'agendaDay');
                    });
                }
            });
        }

And you are done !

klonos’s picture

Title: Clickable day numbers/headers for easier navigation (for fullcalendar.js 1.5.2). » Clickable day numbers/headers for easier navigation (for fullcalendar.js).

...while you go tying out these proposed solutions, please keep in mind that fullcalendar.js 1.7.2 seems to have known issues with the latest jQuery 1.8.0: http://code.google.com/p/fullcalendar/issues/detail?id=1499

Just a heads-up ;)

klonos’s picture

Update from the issue again (as always, I claim no credits):

I rewrote a bit #29 solution in order to be compatible with fullCalendar 1.6.

Very easy implementation, no need to hack fullCalendar.js :

    columnFormat : {
        week: "'<div data-date=\'yyyy-MM-dd\'>'ddd dd/MM'</div>'" // add a data-date attribute to the day header in week view
    },
    viewDisplay: function(view) {
        if (view.name == 'month') {
            // a click on the day number should switch the calendar to week view
            var $headers = $('.fc-day-number');
            $headers.each(function() {
                var date = $(this).parent().parent().attr('data-date');
                $(this).attr(
                    'onmousedown',
                    '$(\'#agenda\').fullCalendar(\'changeView\', \'agendaWeek\').fullCalendar(\'gotoDate\', new Date(\''+ date +'\'))'
                );
            });
            $headers.css({'cursor':'pointer', 'width':'100%', 'text-align':'right', 'border-bottom':'1px dotted #ddd'} );
        }

        if (view.name == 'agendaWeek') {
            // a click on the day number should switch the calendar to day view
            var $headers = $('.fc-widget-header[class*=fc-col]');
            $headers.click(function() {
                var date = new Date($(this).children().first().attr('data-date'));
                $('#agenda').fullCalendar('changeView', 'agendaDay').fullCalendar('gotoDate', date);
            });
            $headers.css({'cursor':'pointer'});
        }

That's all, thanks to all posters for your ideas !

nerdoc’s picture

Hm @klonos - sorry to ask a 'newbie'-question. But is it enough to only add the code from #7 to my js file?

(function($) {
Drupal.behaviors.mymodule = {
attach: {[...snip...]},
columnFormat : {
    week: "<div..."
},
viewDisplay: function(view) {
    if (view...
};
})(jQuery);   

is this correct/enough?
It at least here does not work. Could you give me hint? The attach code is executed and works. But the viewDisplay part is never executed. I use D7.31 and fullcalendar 1.6.