我使用FullCalendar 3,我将事件属性名称更改为start_at
& end_at
代替start
&使用end
& startParam
endParam
<script>
$(document).ready(function() {
$('#calendar').fullCalendar({
locale: 'en',
header: {
left: 'prev,next today',
center: 'title',
right: 'month,agendaWeek,agendaDay'
},
defaultDate: '2017-04-12',
navLinks: true,
editable: true,
eventLimit: true,
events: {
startParam: 'start_at',
endParam: 'end_at',
url: '/products/all',
color: 'yellow'
},
eventRender: function(event, element) {
element.find('.fc-title').html(event.name);
}
});
});
</script>
就像他们在docs中所说的那样,但它仍然不起作用。这是我的JS:
url
[
{
id: 1,
name: "Product 1",
date: "2017-04-11",
start_at: "2017-04-09 18:58:47",
end_at: "2017-04-09 19:58:47",
created_at: "2017-04-09 19:13:47",
updated_at: "2017-04-09 19:13:47",
},
...
]
接受具有以下结构的JSON Feed:
date
问题是显示事件并使用JSON中定义的start_at
属性而不是我定义的end_at
或Uncaught TypeError: Cannot read property 'hasTime' of undefined
,如果我删除它,我会收到此错误{ {1}},即使我确实像这样定义了events
:
events: {
startParam: 'start_at',
endParam: 'end_at',
//...
}
提前谢谢。
答案 0 :(得分:0)