[英]How to hide previous and next month dates and events from yearview of fullcalender?
[英]Fullcalender next and previous make more function call in MVC4
我已经尝试过用Fullcalender.js和Moment()在jquery中编写代码。
$(document).ready(function () {
var CalLoading = true;
$('#calendar').fullCalendar({
header: {
left: 'prev,next today',
center: 'title',
right: 'month,agendaWeek,agendaDay'
},
defaultView: 'month',
defaultDate:moment(),
editable: true,
allDaySlot: false,
selectable: true,
slotMinutes: 15,
events: function (start, end, callback) {
$.getJSON("@Url.Action("EventSummary")", function (locationsArray) {
var result = $(locationsArray).map(function () {
return {
title: this.title,
start: this.start,
end: this.end,
allDay: this.editable
};
}).toArray();
callback(result);
});
},
eventClick: function (calEvent, jsEvent, view) {
alert('You clicked on event id: ' + calEvent.id
+ "\nSpecial ID: " + calEvent.someKey
+ "\nAnd the title is: " + calEvent.title);
},
eventDrop: function (event, dayDelta, minuteDelta, allDay, revertFunc) {
if (confirm("Confirm move?")) {
UpdateEvent(event.id, event.start);
}
else {
revertFunc();
}
},
eventResize: function (event, dayDelta, minuteDelta, revertFunc) {
if (confirm("Confirm change appointment length?")) {
UpdateEvent(event.id, event.start, event.end);
}
else {
revertFunc();
}
},
dayClick: function (date, allDay, jsEvent, view) {
$('#eventTitle').val("");
$('#eventDate').val(moment(date).format('DD/MM/YYYY'));
$('#eventTime').val(moment(date).format('HH:mm'));
ShowEventPopup(date);
},
viewRender: function (view, element) {
if (!CalLoading) {
if (view.name == 'month') {
$('#calendar').fullCalendar('removeEventSource', sourceFullView);
$('#calendar').fullCalendar('removeEvents');
$('#calendar').fullCalendar('addEventSource', sourceSummaryView);
}
else {
$('#calendar').fullCalendar('removeEventSource', sourceSummaryView);
$('#calendar').fullCalendar('removeEvents');
$('#calendar').fullCalendar('addEventSource', sourceFullView);
}
}
}
});
CalLoading = false;
});
它具有调用prev的功能,每次点击都会使调用增加两次
Hai @Saneesh试试这个...
events: function (start, end, timezone, callback) {
$.ajax({
url : '@Url.Action("GetEvents","FullCalender")',
dataType: "json",
data: {
start: start.unix(),
end: end.unix()
},
success: function (doc) {
var events = [];
$.each(doc, function (i, item) {
//alert(item["title"]);
events.push({
title: $(this).attr('title'),
start: $(this).attr('start'), // will be parsed
end: $(this).attr('end')
});
});
callback(events);
}
});
}
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.