[英]Set custom variables to calEvent in jQuery weekcalendar
我正在與jQuery weekcalendar一起顯示帶有約會的基於Web的日歷。 一些內置函數(如setEventUserId
將一些變量存儲在calEvent中。
在此calEvent對象中存儲自定義變量該怎么辦?
就像是:
setEventCategoryId: function(calendarId, calEvent, calendar) {
calEvent.calendarId = calendarId;
return calEvent;
},
getEventCategoryId: function(calEvent, calendar) {
return calEvent.calendarId;
}
但是何時調用此方法? 僅用這段代碼存儲變量就足夠了嗎?
非常感謝任何輸入。
插件內部存儲的變量由插件內部使用。 插件內部未使用您的自定義變量,因此使用插件存儲它們是沒有意義的。
您可以使用jQuery的.data()
函數針對元素存儲任意數據。
例如設置:
$(calEvent).data('calendarId', calendarId);
要檢索:
var calendarId = $(calEvent).data('calenderId');
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.