gpt4 book ai didi

javascript - FullCalendar 2.1.1 不显示事件

转载 作者:行者123 更新时间:2023-12-03 11:48:10 25 4
gpt4 key购买 nike

我在我的应用程序中配置了 FullCalendar 版本 2.1.1,但它根本不显示事件,我用 google 搜索了很多,但无法解决问题。

这是我的代码:

$("#fullcalendar").fullCalendar({
"allDayDefault": false
, "allDaySlot": false
, "defaultView": "agendaWeek"
, "editable": true
, "eventClick": function(event, jsEvent, view) {
$("#data_inicial_evento").val(event.start.format("DD/MM/YYYY"));
$("#hora_inicial_evento").val(event.start.format("HH:mm"));

if (event.end) {
$("#data_final_evento").val(event.end.format("DD/MM/YYYY"));
$("#hora_final_evento").val(event.end.format("HH:mm"));
} else {
$("#data_final_evento").val(event.start.format("DD/MM/YYYY"));
$("#hora_final_evento").val(event.start.format("HH:mm"));
}

$("#titulo_evento").val(event.title);
$("#categoria_evento").val(event.categoria);
$("#form_editar_evento").attr("action", "{{ baseRoute }}/cadastro/evento/editar/" + event.id);
$("#apagar_evento").attr("data-idEvento", event.id);
$("#conteiner_form_editar_evento").dialog("open");
}
, "eventDrop": function(event, delta, revertFunc, jsEvent, ui, view) {
$.post(
"{{ baseRoute }}/cadastro/evento/alterarEventoAjaxUI"
, {
"idEvento": event.id
, "dayDelta": delta.asDays()
, "minuteDelta": delta.asMinutes()
, "evento": "dragndrop"
}
).done(function(data) {
var obj = $.parseJSON(data);
if (!obj.result) {
revertFunc();
}
}).fail(function() {
revertFunc();
});
}
, "eventResize": function(event, delta, revertFunc, jsEvent, ui, view) {
$.post(
"{{ baseRoute }}/cadastro/evento/alterarEventoAjaxUI"
, {
"idEvento": event.id
, "dayDelta": delta.asDays()
, "minuteDelta": delta.asMinutes()
, "evento": "resize"
}
).done(function(data) {
var obj = $.parseJSON(data);
if (!obj.result) {
revertFunc();
}
}).fail(function() {
revertFunc();
});
}
, "events": "{{ baseRoute }}/cadastro/evento/listarEventosAjaxUI"
, "header": {
"left": "prev,next today"
, "center": "title"
, "right": "month,agendaWeek,agendaDay"
}
, "select": function(start, end, jsEvent, view) {
var dataEvento;

// se for um evento de dia inteiro
if (view.name === "month") {
if (end.diff(start, 'days') > 1) {
dataEvento = start.format("dddd, DD/MM/YYYY") + " ";
dataEvento += "<br />até<br />";
dataEvento += end.clone().subtract(1, 'days').format("dddd, DD/MM/YYYY");
} else {
dataEvento = start.format("dddd, DD/MM/YYYY");
}
} else {
dataEvento = start.format("dddd, DD/MM/YYYY HH:mm") + " - ";
dataEvento += end.format("HH:mm");
}

$("#data_inicial_novo_evento").val(start.format("DD/MM/YYYY"));
$("#hora_inicial_novo_evento").val(start.format("HH:mm"));
$("#data_final_novo_evento").val(end.format("DD/MM/YYYY"));
$("#hora_final_novo_evento").val(end.format("HH:MM"));
$("#span_data_novo_evento").html(dataEvento);
$("#conteiner_form_novo_evento").dialog("open");
}
, "selectHelper": true
, "selectable": true
, "timezone": "local"
});

这是我如何从 json 源获取事件数据:

[
{
"title":"agendas"
,"start":1407409200
,"end":1407416400
,"id":16
,"allDay":false
,"usuario":"anderson"
,"categoria":13
}
,{
"title":"culto"
,"start":1407085200
,"end":1407094200
,"id":17
,"allDay":false
,"usuario":"anderson"
,"categoria":9
}
// and so on...
]

我真的不知道出了什么问题:(

最佳答案

您的 startend 参数是时间戳。 FullCalendar documentation of startParam states :

A parameter of this name will be sent to each JSON event feed. It describes the start of the interval being fetched.

String, default: 'start'

The actual value of this parameter will be an ISO8601 date string.

维基百科有关于 ISO 8601 的详细信息,因此您的参数应采用以下格式之一:

  1. 2014-09-22
  2. 2014-09-22 15:00:00
  3. 2014-09-21T13:00:00Z

关于javascript - FullCalendar 2.1.1 不显示事件,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/25953951/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com