我正在使用完整日历。
以下是问题的示例:
问题在于,无论如何,非工作日应保持在最佳状态。默认任务应该在nwd和超酷项目之间滑动。
有人知道我可以在服务器端做什么,目前这样做:
var sortedList = eventList
.OrderBy(p => p.resource).
ThenBy(p => new
DateTime(ConvertFromUnixTimestamp(p.start).Year,
ConvertFromUnixTimestamp(p.start).Month,
ConvertFromUnixTimestamp(p.start).Day)
).ThenBy(p => !p.isDate)
.ThenBy(p => p.title).ToList();
List<dynamic> finalList = new List<object>();
for (int i = 0; i < sortedList.Count(); ++i)
{
var e = sortedList.ElementAt(i);
finalList.Add(
new
{
id = i.ToString(),
realid = e.realid,
isDate = e.isDate,
title = e.title,
start = ResolveStartDate(StartDate(ConvertFromUnixTimestamp(e.start).AddSeconds(i))),
end = e.end,
description = e.description,
allDay = e.allDay,
resource = e.resource,
editable = e.editable,
color = e.color
}
);
}
JavaScriptSerializer js = new JavaScriptSerializer();
string strJSON = js.Serialize(finalList);
或客户端,fullcalendar似乎有:
function segCmp(a, b) {
//return (b.msLength - a.msLength) * 100 + (a.event.start - b.event.start);
return (a.event.start - b.event.start);
}
function segsCollide(seg1, seg2) {
//return seg1.end > seg2.start && seg1.start < seg2.end;
return false;
}
/* Event Sorting
-----------------------------------------------------------------------------*/
// event rendering utilities
function sliceSegs(events, visEventEnds, start, end) {
var segs = [],
i, len=events.length, event,
eventStart, eventEnd,
segStart, segEnd,
isStart, isEnd;
for (i=0; i<len; i++) {
event = events[i];
eventStart = event.start;
eventEnd = visEventEnds[i];
if (eventEnd > start && eventStart < end) {
if (eventStart < start) {
segStart = cloneDate(start);
isStart = false;
}else{
segStart = eventStart;
isStart = true;
}
if (eventEnd > end) {
segEnd = cloneDate(end);
isEnd = false;
}else{
segEnd = eventEnd;
isEnd = true;
}
segs.push({
event: event,
start: segStart,
end: segEnd,
isStart: isStart,
isEnd: isEnd,
msLength: segEnd - segStart
});
}
}
return segs.sort(segCmp);
}
// event rendering calculation utilities
function stackSegs(segs) {
var levels = [],
i, len = segs.length, seg,
j, collide, k;
for (i=0; i<len; i++) {
seg = segs[i];
j = 0; // the level index where seg should belong
while (true) {
collide = false;
if (levels[j]) {
for (k=0; k<levels[j].length; k++) {
if (segsCollide(levels[j][k], seg)) {
collide = true;
break;
}
}
}
if (collide) {
j++;
}else{
break;
}
}
if (levels[j]) {
levels[j].push(seg);
}else{
levels[j] = [seg];
}
}
return levels;
}
这可能允许跨越多天的事件始终保持在非工作日之下?事件中将非工作日定义为isDate。因此,如果是event.isDate,则它是一个非工作段。
由于