如何在初始化时动态设置完整日历的默认视图

时间:2016-10-07 07:46:31

标签: jquery fullcalendar fullcalendar-scheduler

我将完整日历设置为在标签上显示。加载页面时,根据事件的开始和结束日期,我想设置日历的默认视图。但在创建完整日历后,事件未定义。该事件通过ajax调用加载,但此时该函数未被调用。

谢谢!

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>

通过我在主要容器上的输入和日期选择器(开始日期时间,结束日期时间)在时间表上显示/更新,因此可以通过主容器中的控件添加新事件或编辑事件。

$(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);

但事件未定义,因为在加载页面或直到没有显示选项卡(即单击包含计划的选项卡)获取事件,资源未完成。

0 个答案:

没有答案