Javascript 在选择时使用参数触发完整日历刷新
在选择框中选择值时,我希望使用特定参数触发刷新事件 我在grails标记中定义了选择框:Javascript 在选择时使用参数触发完整日历刷新,javascript,jquery,grails,fullcalendar,Javascript,Jquery,Grails,Fullcalendar,在选择框中选择值时,我希望使用特定参数触发刷新事件 我在grails标记中定义了选择框: <g:select name="resourceId" from="${Resource.list()}" optionKey="id" optionValue="name" onchange="refreshCalendar()"/> 我的日历配置为: $('#ca
<g:select name="resourceId"
from="${Resource.list()}"
optionKey="id"
optionValue="name"
onchange="refreshCalendar()"/>
我的日历配置为:
$('#calendar').fullCalendar({
events: '${createLink(action:'loadSchedule' )}'
}
现在如何在选择框中选择id参数的情况下,在fullcalendar配置中提供日历刷新功能或事件项
谢谢我不知道这是不是一种“酷”的方式,但它现在正在使用此解决方案:
var source;
function refreshCalendar(id) {
source = '${createLink(action:'loadSchedule' )}' + '?resourceId=' + id;
$('#calendar').fullCalendar('removeEvents');
$('#calendar').fullCalendar('addEventSource', source );
$('#calendar').fullCalendar('rerenderEvents');
$('#calendar').fullCalendar('removeEventSource', source );
}
因此,日历正在加载新的src,随后将其删除不知道这是否是“酷”的方式,但它现在正在使用此解决方案:
var source;
function refreshCalendar(id) {
source = '${createLink(action:'loadSchedule' )}' + '?resourceId=' + id;
$('#calendar').fullCalendar('removeEvents');
$('#calendar').fullCalendar('addEventSource', source );
$('#calendar').fullCalendar('rerenderEvents');
$('#calendar').fullCalendar('removeEventSource', source );
}
因此,日历将加载新的src,然后将其删除