Glo*_*tin 1 jquery events fullcalendar
我想为 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"]
}
Run Code Online (Sandbox Code Playgroud)
首先,您需要确保您使用的是FullCalendar v.2.4
然后,您需要删除“描述”周围的括号“[]”。
eventOrder: "description"
Run Code Online (Sandbox Code Playgroud)
检查这个小提琴,我按标题降序排序:http : //jsfiddle.net/slyvain/waa23ry0/
| 归档时间: |
|
| 查看次数: |
8031 次 |
| 最近记录: |