我添加了jquery完整日历,它运行正常。但它没有正确渲染自定义字段。
$('.calendar').each(function () {
var calendar = $(this);
calendar.fullCalendar({
header: {
left: 'prev, next today',
center: 'title',
right: 'month,basicWeek,basicDay'
},
selectable: true,
selectHelper: true,
editable: false,
displayEventTime: false,
eventLimit: true,
events: [{"id":22,"title":"john","start":"2017-03-30","end":"2017-03-31","color":"green","allDay":true,"last_name":"doe"}],
eventRender: function(event, element) {
element.attr("content",event.last_name)
}
});
})
此处last_name
未显示在calendar
中。但默认字段显示正常。如何在日历中显示last_name?
答案 0 :(得分:1)
如果有人需要,这就是要走的路。在github
问题的帮助下得到了这个解决方案。
eventRender: function(event, element) {
element.append(event.last_name);
}
#or wrapping it with html:
eventRender: function(event, element) {
element.append('<span style="color: pink;">' + event.last_name + '</span>');
}