Issue 1133: Render method should maintain agenda views' scroll
Status:  ExportedToGithub
Owner: ----
Closed:  Aug 2015
Reported by mcca...@gmail.com, Sep 30, 2011
Hi,

I have a fullCalendar in a div:

<div id="calendar"></div>

When I click on an event in the calendar, I want to switch to fill in a form in a full page.

This is basically what is called:

function switchToFull() {
        if ($('#create_event_dialog').dialog('isOpen')) {
           $('#create_event_dialog').dialog('destroy');
        }
        $('#calendar').hide();
        $('#fullEventForm').show();
}

When the user clicks the Cancel button in the form, it simply hides the form div and shows the calendar div again. However, when the calendar div is shown, it loses the firstHour configuration (set to 8 am) and *reverts to 12am* in the agendaDay view or agendaWeek view:

function switchToCalendar() {
        $('#fullEventForm').hide();
        $('#calendar').show();
        // None of the following work to have the calendar have the calendar show 8 am as the top of the scroll window
        //$('#calendar').fullCalendar('options','firstHour', 8);
        //$('#calendar').fullCalendar('rerenderEvents');
        //$('#calendar').fullCalendar('render');
}

If I click on Next/Previous Day or Next/Previous Week, it reverts to showing 8am at the top of the scroll window.

Below is the full definition of the calendar:
  $(document).ready(function(){
      $('#calendar').fullCalendar({
          aspectRatio: 1.7,
          firstHour: 8,
          editable: true,
          ignoreTimezone: false,
          header: {
              left: 'prev,next today',
              center: 'title',
              right: 'month,agendaWeek,agendaDay'
          },
          selectable: true,
          selectHelper: true,
          select: function(start, end, allDay) {
                jQuery.ajax({
                        data: 'starttime=' + start + '&endtime=' + end + '&allday=' + allDay,
                        dataType: 'script',
                        type: 'get',
                        url: "/events/new"
                });
          },
          defaultView: 'agendaWeek',
          slotMinutes: 30,
          loading: function(bool){
              if (bool) 
                  $('#loading').show();
              else 
                  $('#loading').hide();
          },
          events: "/events/get_events",
          timeFormat: 'h:mm t{ - h:mm t} ',
          dragOpacity: "0.5",
          eventDrop: function(event, dayDelta, minuteDelta, allDay, revertFunc){
                  moveEvent(event, dayDelta, minuteDelta, allDay);
          },
          eventResize: function(event, dayDelta, minuteDelta, revertFunc){
                  resizeEvent(event, dayDelta, minuteDelta);
          },
          eventClick: function(event, jsEvent, view){
              showEventDetails(event);
          },
      
      });
  });
Oct 2, 2011
Project Member #1 adamrs...@gmail.com
sorry, i cant provide detailed help on project-specific issues. this tracker is for bugs/feature-requests dealing with fullcalendar's source code. if you can whittle down your code to demonstrate a specific bug w/ fc, that would be acceptable.
Status: Done
Oct 4, 2011
#2 mcca...@gmail.com
Hi - this is definitely not project-specific. Stick the attached into the demos directory of fullcalendar and you'll see what I mean.


showdiverror.html
2.8 KB   View   Download
Jan 9, 2012
Project Member #3 adamrs...@gmail.com
k, sorry, will try to reproduce this..
Status: Reproducing
Jan 16, 2012
#4 mvugteveen
is there any news on this issue.... I have the same problem.
Sep 28, 2012
#5 hotbluee...@gmail.com
I have the same problem.

I'm re-sizing the div on a click event where the full Calendar resides.  I invoke a render of the calendar and it ignores the firstHour setting and defaults to 12 am.
Nov 12, 2012
#6 alistair...@gmail.com
Same issue here.  Create a page with two tabs, place a calendar on each, using the same events and firstHour option.  The first calendar displays at the correct firstHour.  Click to another tab; that calendar is at midnight.  Click back to original calendar tab, and that one is now at midnight as well.

Found in IE9.  Does not occur in latest version of Chrome.
Feb 18, 2013
#7 greg.gof...@gmail.com
I'll throw some support behind finding a fix for this.  I experience the same thing, after any call to $('#mything').fullCalendar('render') the firstHour is ignored, and the calendar renders at midnight.  In my case I have something like:

$(window).resize(function () {
    //the window has resized, so redraw the full calendar container and re-render
    ...
    $('#mything').fullCalendar('render'); //renders at midnight
}).resize();
Aug 13, 2013
Project Member #8 adamrs...@gmail.com
It will be hard to have fullcalendar automatically do this. Thinking the render method would explicitly need to be called. But yeah, a call to render should keep the scroll state. Renaming this issue appropriately...
Summary: Render method should maintain agenda views' scroll (was: Hiding then showing calendar div loses firstHour configuration)
Status: Accepted
Labels: Type-BehaviorMod
Aug 14, 2013
Project Member #9 adamrs...@gmail.com
(No comment was entered for this change.)
Labels: -Type-BehaviorMod Type-Behavior
Apr 19, 2015
Project Member #10 adamrs...@gmail.com
(No comment was entered for this change.)
Labels: -Type-Behavior Type-Feature
Aug 21, 2015
Project Member #11 adamrs...@gmail.com
Discussion for this issue has moved to the following URL:
https://github.com/fullcalendar/fullcalendar/issues/1400

This is because Google Code is shutting down. Apologies if you are being pestered with these notifications. This is a one-time event.

Happy coding,
Adam
Status: ExportedToGithub