2014-12-29 74 views
5

我正在嘗試使用營業時間選項,但無法反映這些更改。全日曆營業時間

我想顯示多個營業時間

這裏是代碼;

$('#calendar').fullCalendar({ 
    header: { 
     left: 'prev,next today', 
     center: 'title', 
     right: 'month,agendaWeek,agendaDay' 
    }, 
    defaultDate: '2014-11-12', 
    editable: true, 
    eventLimit: true, // allow "more" link when too many events 
    businessHours: 
     [ 
     { 
    start: '10:00', // a start time (10am in this example) 
    end: '12:00', // an end time (12pm in this example) 
    dow: [ 1,2,3,4 ] 
    // days of week. an array of zero-based day of week integers (0=Sunday) 
    // (Monday-Thursday in this example) 
    }, 
    { 
    start: '12:00', // a start time (12pm in this example) 
    end: '18:00', // an end time (6pm in this example) 
    dow: [ 1,2,3,4 ] 
    // days of week. an array of zero-based day of week integers (0=Sunday) 
    // (Monday-Thursday in this example) 
    }] 
    }); 

回答

7

像這樣

businessHours: 
    { 

      start: '11:00', 
      end: '12:00', 
      dow: [ 1, 2, 3, 4, 5] 
    }, 

,以便使用不同的小時,不同的偏移 - >使用背景事件

events: 
[ 
    { 
     id: 'available_hours', 
     start: '2015-1-13T8:00:00', 
     end: '2015-1-13T19:00:00', 
     rendering: 'background' 
    }, 
    { 
     id: 'work', 
     start: '2015-1-13T10:00:00', 
     end: '2015-1-13T16:00:00', 
     constraint: 'available_hours' 
    } 
] 

有關詳細信息,請參閱此鏈接, http://fullcalendar.io/docs/event_ui/eventConstraint/

有幾種不同的方法可以處理這個問題s,這取決於你如何使用日曆。希望約束的靈活性能幫助你得到你需要做的。

很高興這個功能終於出現了!

+1

由於兄弟, 我試圖其工作正常,但其不工作的日常(我的意思是移位) SHIFT1上的多個業務時間:8 - > 12 SHIFT2:14 - > 20 VAR businessHours = } {{「start」:'08:00:00','end':'12:00:00','dow':[1,2,3,4] } 14:00:00','end':'20:00:00',「dow」:[1,2,3,4] }]; 其不工作 –

+1

我建議利用後臺事件。在文檔中檢查它們。他們的工作更像事件,但您可以將它們附加到其他事件的功能上。如果沒有問題,我會將其添加到我的答案中。 – DoverAudio

1

我必須顯示FullCaledar時間槽爲8AM到8PM固定,所以我做了一些R & D,並應用以下選項,它似乎工作正常!乾杯。

jq('#calendar').fullCalendar({ 
     header: { 
      left: 'prev,next', 
      center: 'title', 
      right: 'today,month,agendaWeek,resourceDay' 
     }, 
     defaultView: 'resourceDay', 
     allDaySlot: false, 
     axisFormat: 'h:mm A', 
     timeFormat: 'h:mm T', 
     minTime: '08:00:00', 
     maxTime: '20:00:00', 

使用, minTime:08:00:00' , MAXTIME:'20:00:00'

謝謝!