[英]Get userId in jQuery weekcalendar when adding a new event
我正在使用jQuery weekcalendar在日歷中顯示約會,然后單擊即可添加新約會。 在eventNew
函數中,我嘗試獲取已添加約會的userId
。 誰能告訴我如何實現這一目標?
我能夠得到約會的開始和結束日期:
eventNew : function(calEvent, $event, FreeBusyManager, calendar) {
var isFree = true;
$.each(FreeBusyManager.getFreeBusys(calEvent.start, calEvent.end), function() {
if (
this.getStart().getTime() != calEvent.end.getTime()
&& this.getEnd().getTime() != calEvent.start.getTime()
&& !this.getOption('free')
){
isFree = false;
return false;
}
});
// add the event to the database
console.log('start of new calendar event: ' + calEvent.start);
console.log('end of new calendar event: ' + calEvent.end);
// how do I get the userId here?
}
在Wiki中 ,我找到了一個名為getUserId
的函數,但是我不知道如何實現它。 任何幫助表示贊賞。
編輯:日歷是多用戶就緒。 可以為不同的用戶設置事件。
好的,我知道了。 所有這些函數都被調用,但是您必須自己實現它們。 因此,這段代碼設置了事件的userId
:
setEventUserId: function(userId, calEvent, calendar) {
console.log('set eventuserid is called');
calEvent.userId = userId;
return calEvent;
},
在eventNew
您可以調用userId
:
eventNew : function(calEvent, $event, FreeBusyManager, calendar) {
var isFree = true;
$.each(FreeBusyManager.getFreeBusys(calEvent.start, calEvent.end), function() {
if (
this.getStart().getTime() != calEvent.end.getTime()
&& this.getEnd().getTime() != calEvent.start.getTime()
&& !this.getOption('free')
){
isFree = false;
return false;
}
});
// add the event to the database
console.log('start of new calendar event: ' + calEvent.start);
console.log('end of new calendar event: ' + calEvent.end);
console.log('userId of new calendar event: ' + calEvent.userId);
},
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.