Dave
Dave

Reputation: 73

Problem with Jquery Fullcalendar and filtering events

I've got a fullcalendar script running with an event filter for different locations in a dropdown. The filter works by sending the location requested to the server-side script which then returns a list of events for that location. Thus:

$('#calendar').livequery(function(){
var locationfilter = $('#locationfilter').val();
$(this).fullCalendar({
    header: {left: 'prev,next today',center: 'title',right: 'month'},
    defaultView:'month',
    editable: false,
       events: 'calendar_json.php?locationfilter='+locationfilter
});

$('#locationfilter').livequery('change',function(){
var locationfilter = $('#locationfilter').val();
$('#calendar').fullCalendar('removeEvents');
$('#calendar').fullCalendar('addEventSource', 'calendar_json.php?locationfilter='+locationfilter);
$('#calendar').fullCalendar('rerenderEvents');

    }); 

However, my problem is that while this filters the events very well, when I change month it brings events back in for ALL locations and not just the one for the location selected. I tried rerendering using the viewDisplay callback, but that didn't help, and just made the problem worse by duplicating them all as well.

Any ideas on how to make that happen? I've got the latest version of fullcalendar, but I'm still on Jquery 1.3.2 (for a number of reasons that I won't go into)

Upvotes: 0

Views: 2337

Answers (2)

Rusty
Rusty

Reputation: 186

http://code.google.com/p/fullcalendar/issues/detail?id=678

has a solution for this, it involves changing fullcalendar.js but it worked great for me.

Upvotes: 1

Magnus Winter
Magnus Winter

Reputation: 931

I'm not sure that I understand the question completely, but fullcalendar sends start and end parameters for the actual view with the Json request.

An example from the documentation about json feeds

says this: /myfeed.php?start=1262332800&end=1265011200&_=1263178646 where both start and end are unix timestamps. If I understand you correctly this is what you want to use in your php-file to send only events between start and end. The livequery should then just have to be removed.

Upvotes: 0

Related Questions