在Ajax数据库更新后,在fullCalendar中重新渲染事件 [英] rerendering events in fullCalendar after Ajax database update

查看:4070
本文介绍了在Ajax数据库更新后,在fullCalendar中重新渲染事件的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我试图让fullCalendar反映通过AJAX对数据库所做的更改。问题是,在成功的AJAX调用后它不会更新屏幕上的日历。

I am trying to have fullCalendar reflect changes made to a database via AJAX. The problem is that it won't update the calendar on screen after a successful AJAX call.

$.ajax({
    type: "POST",
    url: "eventEditXHR.php",
    data: {
       //the data
    },
    success: function(text) {
      $("#calendar").fullCalendar("refetchEvents");
    }....

我使用了错误的方法吗?不用重新加载整个页面,最好的方法是什么?感谢您的任何输入!

I'm I using the wrong method? What would be the best way to accomplish this without having to reload the whole page? Thanks for any input!

推荐答案

有几种方法,有些不那么优雅。

1.如果您使用FullCalendar抓取json事件:



There are several ways. Some less elegant.

$('#calendar').fullCalendar({ events: "json-events.php",    });

只要做:

Just do:

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



If你需要外部方法来获取你可以做的事件。不优雅,但会工作



If you want outside method to fetch events you could do. Not elegant but will work

$('#calendar').fullCalendar( 'removeEventSource', source )
$('#calendar').fullCalendar( 'addEventSource', source )

这篇关于在Ajax数据库更新后,在fullCalendar中重新渲染事件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆