我想使用fullcalendar jquery插件的eventOrder属性,但我找不到如何设置属性的任何示例。 我添加了非标准的字段属性,描述,我想使用它。 如何将此属性设置为eventOrder? 这就是我的活动当前显示的方式:
$('#calendar').fullCalendar({
header:
{
left: 'prev,next today',
center: 'title',
right: 'month,agendaWeek,agendaDay'
},
titleFormat: {month: 'MMMM'},
defaultView: 'month',
events: function (start, end, timezone, callback) {
$.ajax({
type: "POST",
url: '@Url.Action("GetAllEvents", "Home")',
// data: "{'userID':'" + $('#<%= hidUserID.ClientID %>').val() + "'}", //this is what I use to pass who's calendar it is
//completely take out 'data:' line if you don't want to pass to webmethod - Important to also change webmethod to not accept any parameters
contentType: "application/json; charset=utf-8",
dataType: "json",
success: function (doc) {
var events = [];
$(doc).each(function () {
events.push({
title: $(this).attr('title'),
start: $(this).attr('start'),
end: $(this).attr('end'),
id: $(this).attr('id'),
description: $(this).attr('description')
});
});
callback(events);
} ,
error: function () {
alert("There was an error fetching events!")
}
});
},
eventRender: function (event, element) {
element.find('.fc-title').append("<br/>" + event.description);
},
//this is the problem...how to set the eventOrder?
eventOrder: ["description"]
}
答案 0 :(得分:1)
首先,您需要确保使用FullCalendar v.2.4
然后,您需要删除括号&#34; []&#34;周围&#34;描述&#34;。
eventOrder: "description"
检查这个小提琴,我按标题降序排序:http://jsfiddle.net/slyvain/waa23ry0/