这是我的完整日历。当我在特定事件对话框屏幕中单击完整日历时,将打开。
这是我的脚本:
var date = new Date();
var d = date.getDate();
var m = date.getMonth();
var y = date.getFullYear();
var calendar = $('#calendar').fullCalendar({
theme: true,
header: {
left: 'prev,next today',
center: 'title',
right: 'month,agendaWeek,agendaDay'
},
eventClick: updateEvent,
selectable: true,
selectHelper: true,
select: selectDate,
editable: true,
events: "JsonResponse.ashx",
eventDrop: eventDropped,
eventResize: eventResized,
eventRender: function(event, element) {
//alert(event.title);
element.qtip({
content: event.projectdescription,
position: { corner: { tooltip: 'bottomLeft', target: 'topRight'} },
style: {
border: {
width: 1,
radius: 3,
color: '#2779AA'
},
padding: 10,
textAlign: 'center',
tip: true, // Give it a speech bubble tip with automatic corner detection
name: 'cream' // Style it according to the preset 'cream' style
}
});
}
});
});
当单击 evnt 时,将在该对话框中调用“更新事件”功能,因为我在某些 secanrio 中有一个更新按钮,我想禁用它。
var currentUpdateEvent;
var addStartDate;
var addEndDate;
var globalAllDay;
function updateEvent(event, element) {
//alert(event.description);
if ($(this).data("qtip")) $(this).qtip("destroy");
currentUpdateEvent = event;
$('#updatedialog').dialog('open');
$("#eventId").val(event.id);
$("#lblprjnumber").text(event.projectnumber);
$("#lblprjname").text(event.projectname );
$("#lblprjdesc").text(event.projectdescription);
$("#lblMonday").val( event.Monday);
$("#lblTuesday").val(event.Tuesday);
$("#lblwednesday").val(event.Wednesday);
$("#lblthursday").val(event.Thursday );
$("#lblfriday").val(event.Friday);
$("#lblsaturday").val(event.Saturday);
$("#lblsunday").val( event.Sunday);
$("#eventStart").text("" + event.start.toLocaleString());
if (event.end === null) {
$("#eventEnd").text("");
}
else {
$("#eventEnd").text("" + event.end.toLocaleString());
}
}
对于您的参考,我还发布了“更新对话框”
$(document).ready(function() {
// update Dialog
$('#updatedialog').dialog({
autoOpen: false,
width: 470,
buttons: {
"update": function(evt)
{
//alert(currentUpdateEvent.title);
var eventToUpdate = {
id : currentUpdateEvent.id,
projectnumber : $("#lblprjnumber").text(),
projectname : $("#lblprjname").text(),
projectdescription : $("#lblprjdesc").val(),
Monday : $("#lblMonday").val(),
Tuesday : $("#lblTuesday").val(),
Wednesday : $("#lblwednesday").val(),
Thursday : $("#lblthursday").val(),
Friday : $("#lblfriday").val(),
Saturday : $("#lblsaturday").val(),
Sunday : $("#lblsunday").val()
};
if (checkForSpecialChars(eventToUpdate.title) || checkForSpecialChars(eventToUpdate.description)) {
alert("please enter characters: A to Z, a to z, 0 to 9, spaces");
}
else {
PageMethods.UpdateEvent(eventToUpdate, updateSuccess);
$(this).dialog("close");
currentUpdateEvent.projectnumber = $("#lblprjnumber").val();
currentUpdateEvent.projectname = $("#lblprjname").val();
currentUpdateEvent.projectdescription = $("#lblprjdesc").val();
currentUpdateEvent.Monday = $("#lblMonday").val();
currentUpdateEvent.Tuesday = $("#lblTuesday").val();
currentUpdateEvent.Wednesday = $("#lblwednesday").val();
currentUpdateEvent.Thursday = $("#lblthursday").val();
currentUpdateEvent.Friday = $("#lblfriday").val();
currentUpdateEvent.Saturday = $("#lblsaturday").val();
currentUpdateEvent.Sunday = $("#lblsunday").val();
$('#calendar').fullCalendar('updateEvent', currentUpdateEvent);
}
}
}
});