Is there any method to dynamic filter events on client side in fullcalendar? When I get events from server (json_encoded) I assign my own parameter \"school_id\" to every ev
There is solution. I hope this help to someone else.
jQuery("#school_selector").change(function(){
filter_id = $(this).val();
if (filter_id == 'all') {
$("#eventwrapper").fadeOut();
$('#mycalendar').fullCalendar ('removeEvents');
var start_source1 = {
type:'POST',
data: {school_id:'all',filter:'false'},
url: '../../ajax/calendar/get_high_season_events.php',
backgroundColor: 'red'
};
var start_source2 = {
type:'POST',
data: {school_id:'all',filter:'false'},
url: '../../ajax/calendar/get_middle_season_events.php',
backgroundColor: 'orange'
};
var start_source3 = {
type:'POST',
data: {school_id:'all',filter:'false'},
url: '../../ajax/calendar/get_low_season_events.php',
backgroundColor: 'green'
};
$('#mycalendar').fullCalendar('addEventSource', start_source1);
$('#mycalendar').fullCalendar('addEventSource', start_source2);
$('#mycalendar').fullCalendar('addEventSource', start_source3);
}else{
$("#eventwrapper").fadeIn();
$('#mycalendar').fullCalendar ('removeEvents');
var start_source1 = {
type:'POST',
data: {school_id:$("#school_selector").val(),filter:'true'},
url: '../../ajax/calendar/get_high_season_events.php',
backgroundColor: 'red'
};
var start_source2 = {
type:'POST',
data: {school_id:$("#school_selector").val(),filter:'true'},
url: '../../ajax/calendar/get_middle_season_events.php',
backgroundColor: 'orange'
};
var start_source3 = {
type:'POST',
data: {school_id:$("#school_selector").val(),filter:'true'},
url: '../../ajax/calendar/get_low_season_events.php',
backgroundColor: 'green'
};
$('#mycalendar').fullCalendar('addEventSource', start_source1);
$('#mycalendar').fullCalendar('addEventSource', start_source2);
$('#mycalendar').fullCalendar('addEventSource', start_source3);
}//if