I'm using Philipp Frenzel FullCalendar in Yii2 framework and its working perfectly. I want to implement basic filter events on calendar base on option select but my codes still not working. Help would be highly appreciated.
This is main.js :
$("#Model_attribute").change(function(){
filter_id = $(this).val();
if (filter_id != '0') {
var events = $('#event').fullCalendar( 'clientEvents', function(event) {
if((filter_id == '0') ) {
return true;
}else{
//what I need to write here to filter events on calendar????
});
}
}
});
This is option select code :
<select class="Model_attribute" id="select_name">
<option value="all">All Tech</option>
<option value="0">Hendy Nugraha</option>
<option value="1">Ginanjar Nurwin</option>
<option value="2">Rio Andhika</option>
</select>
this is inside event-index :
<?=\yii2fullcalendar\yii2fullcalendar::widget(array(
'events'=> $events,
'id' => 'event',
'clientOptions' => [
'editable' => true,
'draggable' => true,
'droppable' => true,
],
'eventClick' => "function(calEvent, jsEvent, view) {
$(this).css('border-color', 'red');
$.get('index.php?r=event/update',{'id':calEvent.id}, function(data){
$('.modal').modal('show')
.find('#modelContent')
.html(data);
})
$('#calendar').fullCalendar('removeEvents', function (calEvent) {
return true;
});
}",
));
?>
from Yii2 full calendar event filtering not working
No comments:
Post a Comment