views:

89

answers:

1

Hi! I'm trying to store fullcalendar selected date and restore it after postback. I get this date from Session via ajax and then use this code:

$('#calendar').fullCalendar('gotoDate', selectedDate);

It works fine if selectedDate is not in default view - all events are shown after load. But if selected date is in default view - I get empty calendar without events.

For example, if now it's july, 30 (Fri) and I use agendaWeek, I see by default the week starts at july,26, ends at Aug,1st. So if July,26 <= selectedDate <= Aug,1, i get empty calendar after gotoDate. But if selectedDate > Aug,1 || selectedDate < July,26, it's work fine.

Please help. Thanks

A: 

... I think, I found solution:

var view = $('#calendar').fullCalendar('getView');
if(selectedDate < view.start || selectedDate >= view.end)
 $('#calendar').fullCalendar('gotoDate', selectedDate);

But may be somebody have better ideas?..

katrin