在fullcalendar中是否有任何方法可以在客户端上动态过滤事件?当我从服务器(json_encoded)获取事件时,我将自己的参数"school_id"分配给每个事件.在fullcalendar准备好之后,我想用"select"动态过滤事件.
我在页面上添加"select"元素,如下所示:
<select id='school_selector'>
<option value='all'>All schools</option>
<option value='1'>school 1</option>
<option value='2'>school 2</option>
</select>
Run Code Online (Sandbox Code Playgroud)
在javascript代码中我添加:
jQuery("#school_selector").change(function(){
filter_id = $(this).val();
if (filter_id != 'all') {
var events = $('#mycalendar').fullCalendar( 'clientEvents', function(event) {
if((filter_id == 'all') ) {
return true;
}else{
//what I need to write here to dynamic filter events on calendar?
});
}
});
Run Code Online (Sandbox Code Playgroud)
但它不起作用.任何帮助都会很棒.谢谢.