當我們點擊p:schedule的prev或next導航時,我想要移動p:calendar的選定日期(如google日曆中)。鏈接p:時間表prev next按鈕p:日曆如google日曆
<p:calendar mode="inline" navigator="true" id="inlineCal" widgetVar="searchCalVar"
value="#{bean.miniCalDate}" style="width:200px;">
<p:ajax event="dateSelect" listener="#{bean.handleDateSelect}" update="calendarselectedvalue accord" />
</p:calendar>
<p:schedule id="schedule" value="#{bean.eventModel}"
widgetVar="scheduleWidget" draggable="true" resizable="false" allDaySlot="true" slotMinutes="15" firstHour="9" initialDate="#{bean.miniCalDate}" timeZone="UTC" view="agendaWeek" leftHeaderTemplate="today, ,prev,next" rightHeaderTemplate="agendaDay,agendaWeek,month">
</p:schedule>
我試圖
$('.fc-button-next').click(function(){
myFullCal = scheduleWidget.jq.children(":first");
var view = myFullCal.fullCalendar('getView');
if(view.name=='agendaDay')
{
// var newDate=myFullCal.fullCalendar('getDate');
// var newDate=new Date($(PrimeFaces.escapeClientId('accord:calendarselectedvalue')).val());
// var nextSelectedDate=new Date(newDate.setDate(newDate.getDate()+1));
//var newMonth= newDate.getMonth()+1;
//var year = newDate.getFullYear()+"";
//var newYear=year.substring(2);
//var nextDate=newDate.getDate()+'/'+newMonth+'/'+newYear;
cal = searchCalVar.jq.children(":first");
cal.input.val("27/6/14");
}
});
我用Google搜索的解決方案。但一無所獲。
任何幫助將不勝感激。