2014-12-29 73 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'

谢谢!