0

I set the full calendar to be display on a tab. When loading the page, depending the event start and end date I want to set the default view of the calendar. But after creating full calendar the event is undefined. The event is loaded through ajax call, but at that point the function it's not called.

Thank you!

here is how the page looks : 
<div class="main-container"> here are inputs, datepickers<div>
<div class="tabs-container">
<div class="tab1">some info(when load page it is the tab displayed)</div>
<div class="tab2">schedule(it's hide when load page)</div> 
</div>

through the inputs and datepickers(start date time, end date time) from the main container I display/update on the schedule, so it can be added a new event or edit event through the controls from the main container.

$(document).ready(function () {
 var caloption = $("#calendar")
        .fullCalendar({

      groupByDateAndResource: true,
      resources: getScheduleResources,
      events: getScheduleEvents

    });
  caloption.option.defaultView = //method try to get event start time and end time in order to see the difference between days eg. if there is a difference of 6 days the defaultView should be timelineWeek
  $("#calendar").fullCalendar(caleoption);

But the event is undefined because on loading page or until not showing the tab(ie click the tab which contains schedule) getting events, resources it's not done.

Moni
  • 3
  • 3
  • What do you mean display on a tab? When loading the page, you want to set the default view based on the first event? Any event? Can you add some of your code or explain more what you are trying to acomplish? – Ryan89 Oct 07 '16 at 13:25
  • Please see the edited question – Moni Oct 07 '16 at 14:04
  • try setting a var to the value you need outside of the initializer and see if it gets set correctly. So just below the document.ready – Daffy13 Oct 07 '16 at 14:54
  • @Daffy The defaultView will get set depending on the event start and event end. I need to be able to set it dynamically and I can't due to the fact that having the schedule on a hidden tab the ajax call to get events will not happen – Moni Oct 07 '16 at 16:54

0 Answers0