I'm using this answer to filter the events on client side.
It works very well for newer events, but I can't filter events loaded from the JSON.
Here is my JS code:
$(document).ready(function() {
var idEspacoFisico=$('#seleciona option:selected').val();
$("#calendar").fullCalendar({
events: 'eventos/getEventos.json',//can't filter these
eventRender: function eventRender( event, element, view ) {
//from the answer.
return ['0',event.espacoFisico].indexOf($('#seleciona option:selected').val()) >= 0
},
select: function(start, end){
//When created here, I can use the the eventRender to filter.
}
});
$('#seleciona').change(function(){
$("#calendar").fullCalendar('rerenderEvents');
});
});
And HTML:
<select class="form-control" id="seleciona">
<option value="0">Selecione</option>
<option value="1">LAB 1</option>
<option value="2">LAB 2</option>
...
</select>
<div id="calendar"></div>
I miss something? Thanks for the help.