如何向完整日历的现有实例添加更多事件?
我正在查看 FullCalendar 但遇到了几个问题。
问题 1.
我不知道如何向现有实例添加新事件
$('#calendar').fullCalender({ // options set }); // initial set.
现在假设我是否想稍后向该实例添加 json feed 并删除现有 feed。我知道如何做到这一点的唯一方法是
$('#calendar').fullCalendar('removeEventSource', "Calendar/GetDates");
$('#calendar').fullCalendar('addEventSource', "Calendar/GetDatesSearch?term=8");
我认为这有点愚蠢,因为我必须为每个选项选择日历 X 次?我尝试这样做
$('#calendar').fullCalender(
{
addEventSource: "Calendar/GetDatesSearch?term=8",
removeEventSource, "Calendar/GetDates"
});
,但这似乎喜欢生成一个全新的日历。所以我会有多个日历(我不想要的东西)。
我的第二个问题是
我在锚标记上有一个单击事件
<a href="#" id="ReRender">Re-Render</a>
,然后
$('#ReRender').click(function () {
$('#calendar').fullCalendar('removeEventSource', "Calendar/GetDates");
$('#calendar').fullCalendar('addEventSource', "Calendar/GetDatesSearch?term=8");
return false;
});
我第一次单击锚标记(重新渲染)它工作得很好。我再单击它几次,然后点击箭头转到下个月,它将多次渲染相同的提要。
所以我猜测每次我点击它都会添加另一个提要,即使它是完全相同的提要。
所以我点击“重新渲染”50 次并点击下个月。它认为我有 50 个提要,即使它们都是相同的提要。
关于如何解决这个问题有什么建议吗?
I am looking at FullCalendar but I ran into a couple problems.
Problem 1.
I don't know how to add new events to an existing instance
$('#calendar').fullCalender({ // options set }); // initial set.
So now say if I want to add a json feed to this later on and remove an existing feed. The only way I know how to do this is
$('#calendar').fullCalendar('removeEventSource', "Calendar/GetDates");
$('#calendar').fullCalendar('addEventSource', "Calendar/GetDatesSearch?term=8");
I think this is kinda stupid as I got to select the calendar X times for each option? I tried to do
$('#calendar').fullCalender(
{
addEventSource: "Calendar/GetDatesSearch?term=8",
removeEventSource, "Calendar/GetDates"
});
but this seems to like to generate a whole new calendar. So I will have multiple calendars(something I don't want).
My second problem is
I have a click event on a anchor tag
<a href="#" id="ReRender">Re-Render</a>
and then
$('#ReRender').click(function () {
$('#calendar').fullCalendar('removeEventSource', "Calendar/GetDates");
$('#calendar').fullCalendar('addEventSource', "Calendar/GetDatesSearch?term=8");
return false;
});
The 1st I click on the anchor tag(ReRender) it works just fine. I click it a couple more times and hit the arrow to go to the next month it will render the same feed multiple times.
So I am guessing that everytime I do I click even it adds another feed even if it is the exact same feed.
So I click "ReRender" 50 times and hit next month. It thinks I have 50 feeds even though they are all the same feed.
Any recommendations on how to get around this?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
我喜欢完整的日历!添加新事件的过程如下...
第三个参数指定您是否希望在重新渲染提要时保留该事件。通常我会这样做。
还要重新渲染您的事件...
I love fullCalendar! Adding a new event is done like this...
The third parameter specifies if you want the event to stick if the feed is reRendered. Usually I do.
Also to rerender your events...