简体   繁体   中英

Set displayed week period on fullcalendar v2

I'm using Adam Show's excellent fullcalendar plugin v2 beta.

I want to set in the agendaWeek view a specific date as the displayed week start.

So the result would be a 7 day period where the first day would be my given date etc. In the previous versions this behavior was implemented by using visStart, visEnd arguments.

I'm trying the same with the intervalStart, intervalEnd like this

$('#calendar').fullCalendar({
    defaultView : 'agendaWeek',
    slotDuration    : '00:60:00',
    snapDuration    : '00:60:00',
    timezone    : "local",
    allDaySlot  : false,
    scrollTime  : '07:00:00',
    minTime     : '07:00:00',
    maxTime     : '22:00:00',
    now         : moment('2014-05-22').format("YYYY-MM-DDTHH:mm:ssZZ"),
    defaultDate : moment('2014-05-22').format("YYYY-MM-DDTHH:mm:ssZZ"),
    today       : moment('2014-05-22').format("YYYY-MM-DDTHH:mm:ssZZ"),
    intervalStart   : $.fullCalendar.moment('2014-05-22'),
    intervalEnd     : $.fullCalendar.moment('2014-05-29'),
    start           : $.fullCalendar.moment('2014-05-22'),
    end             : $.fullCalendar.moment('2014-05-29'),
    editable: true,
});

but with no effect. You can look at this fiddle: http://jsfiddle.net/yq2gU/9/

var s =" [{'id':1,'name':'Test1'},{'id':2,'name':'Test2'}]";
var myObject = eval('(' + s + ')');

and set one params in your calendar function named events:

$('#calendar').fullCalendar({
    defaultView : 'agendaWeek',
    slotDuration    : '00:60:00',
    snapDuration    : '00:60:00',
    timezone    : "local",
    allDaySlot  : false,
    scrollTime  : '07:00:00',
    minTime     : '07:00:00',
    maxTime     : '22:00:00',
    now         : moment('2014-05-22').format("YYYY-MM-DDTHH:mm:ssZZ"),
    defaultDate : moment('2014-05-22').format("YYYY-MM-DDTHH:mm:ssZZ"),
    today       : moment('2014-05-22').format("YYYY-MM-DDTHH:mm:ssZZ"),
    intervalStart   : $.fullCalendar.moment('2014-05-22'),
    intervalEnd     : $.fullCalendar.moment('2014-05-29'),
    start           : $.fullCalendar.moment('2014-05-22'),
    end             : $.fullCalendar.moment('2014-05-29'),
    editable: true,
    events:myObject,
});

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM