twitter-bootstrap 如何通过事件ID获取事件到fullcalendar?

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/32719358/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-10-21 23:11:51  来源:igfitidea点击:

How to get event by event id into fullcalendar?

javascriptjquerymysqltwitter-bootstrapfullcalendar

提问by user3745888

How is possible get and event by the event id of fullcalendar bootstrap?

如何通过 fullcalendar bootstrap 的事件 id 获取和事件?

I have the event id and I want get the event from this. I'm trying this:

我有事件 ID,我想从中获取事件。我正在尝试这个:

var evento = $("#calendar").fullCalendar( 'clientEvents')[response.idEvent];

response.idEvent is the id event, this is correct (for example '32' from my mysql database), I know this because I print this and is correct, but I don't know how to get the event from this...

response.idEvent 是 id 事件,这是正确的(例如我的 mysql 数据库中的“32”),我知道这是因为我打印了这个并且是正确的,但我不知道如何从中获取事件......

How can get this?

怎么能得到这个?

Thanks!

谢谢!

回答by Buzinas

According to the FullCalendar's documentation, you can achieve what you want by doing:

根据FullCalendar 的文档,您可以通过执行以下操作来实现您想要的:

var evento = $("#calendar").fullCalendar('clientEvents', response.idEvent);

The brackets in the documentation mean that the parameter is optional.

文档中的括号表示该参数是可选的。

回答by Ruslan Korkin

If you want just get all properties of event you can add the [0] and choose properties through dot. For example you have event id as "_fc1" (got it from http://fullcalendar.io/js/fullcalendar-2.4.0/demos/agenda-views.html):

如果您只想获取事件的所有属性,您可以添加 [0] 并通过点选择属性。例如,您的事件 ID 为“_fc1”(从http://fullcalendar.io/js/fullcalendar-2.4.0/demos/agenda-views.html 获取):

var eventoObj = $("#calendar").fullCalendar( 'clientEvents', "_fc1")[0];
var evento_allDay = eventoObj._allDay;
var evento_start = eventoObj._start;
var evento_end = eventoObj._end;

etc.

等等。