【问题标题】:Trigger Full Calendar Refresh with Param on Select在选择时使用参数触发完整日历刷新
【发布时间】:2011-10-13 20:13:16
【问题描述】:

我想在选择框中选择值时触发带有特定参数的刷新事件。

我在 grails 标记中定义了我的选择框:

<g:select name="resourceId"
                from="${Resource.list()}"
                optionKey="id"
                optionValue="name"
                onchange="refreshCalendar()"/>

我知道我可以用标签中的onchange项触发一个JS函数。

刷新日历功能:

$('#calendar').fullCalendar('refetchEvents')

我的日历配置为:

$('#calendar').fullCalendar({
  events: '${createLink(action:'loadSchedule' )}'
}

现在如何在全日历配置中提供日历刷新功能或事件项,并在选择框中选择 id 参数?

谢谢

【问题讨论】:

    标签: javascript jquery grails fullcalendar


    【解决方案1】:

    不知道这是否是“酷”的方式,但它现在正在使用此解决方案:

    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,然后将其删除

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多