我的日历使用fullcalendar插件。它显示了一个弹出窗口来创建一个事件但是在输入事件标题后,它不会在日历上显示事件标题。这里是renderEvent正在调用。请给我一个解决方案< / p>
var calendar = $('#datepicker');
calendar.fullCalendar
({
defaultView: 'agendaWeek',
defaultEventMinutes: 60,
aspectRatio: 1.5,
selectable: true,
selectHelper: true,
dayClick: function(date, allDay, jsEvent, view)
{
dialogBox=$("#dialog").dialog({
autoOpen: false,
modal: true,
show: {
effect: "blind",
duration: 1000
},
hide: {
effect: "explode",
duration: 1000
},
buttons: {
Ok: function() {
name=$("#name").val();
startTime=$("#time-start").val();
endTime= $("#time-end").val();
calendar.fullCalendar('renderEvent',{title:name, start:startTime,end:endTime ,allDay:allDay},true );
$(this).dialog('close');
},
Cancel: function() {
//createEvent=false;
$(this).dialog('close');
}
},
position: [jsEvent.pageX, jsEvent.pageY]
});
$("#time-start").val($.fullCalendar.formatDate(date, 'hh:mmtt'));
$("#time-end").val($.fullCalendar.formatDate(date, 'hh:mmtt'));
if(jsEvent.title == undefined)
{
$("#name").val("");
}
else
{
$("#name").val(jsEvent.title);
}
dialogBox.dialog("open");
},
eventClick: function(calEvent, jsEvent, view) {
console.log('event click');
},
header:
{
left: "prev,next today",
center: "title",
right: "month,agendaWeek,agendaDay"
},
editable: true
});
});
html代码
<div class="divCalendar">
<div id="datepicker" style="margin: 35px;"></div>
<div id="dialog" style="display:none" title="Alert">
<div id="dialog-inner">
<input type="text" name="name" id="name" class="text ui-widget-content ui-corner-all title"><br>
<span class="inline"><input type="text" name="time" id="time-start" class="text ui-widget-content ui-corner-all"></span>
<span class="inline"><input type="text" name="time" id="time-end" class="text ui-widget-content ui-corner-all"></span>
</div>
</div>