2015-08-08 82 views

回答

0

這也不是沒有可能重定製修改。超出了SO問題的範圍。

最容易得到的就是將背景事件作爲「父」事件和常規事件用作子事件。像下面這樣:

var sourceEvents = [ 
    { 
     id: 1, 
     start: moment(), 
     end: moment().add(6,'h'), 
     childEvents: [{ 
      start: moment().add(1,'h'), 
      end: moment().add(2,'h'), 
     }, { 
      start: moment().add(3,'h'), 
      end: moment().add(5,'h'), 
     }], 
    } 
]; 

$("#calendar").fullCalendar({ 
    defaultView: "agendaWeek", 
    events: function(start, end, timezone, callback) { 
     var events = []; 
     sourceEvents.forEach(function(event){ 
      event.rendering = "background"; 
      events.push(event); 
      event.childEvents.forEach(function(childEvent){ 
       // you could do some checks to make sure they are in bounds 
       // you could also do some color coding here 
       childEvent.parentId = event.id; 
       events.push(childEvent); 
      }); 
     }); 
     callback(events); 
    }, 
}); 

JSFiddle