[英]fullcalendar not rendering correctly with meteor
另一種嘗試將其排序。 我在https://github.com/pnunn/testFullCalendar創建了一個回購協議,該回購協議有一個正在運行的流星應用程序,該應用程序顯示了流星無法正確渲染日歷的問題。
首次加載時,日歷上沒有可見的事件。 導航至上個月或下個月,然后再次返回,然后神奇地出現了事件。 如果單擊事件並更改其中一個復選框(事件顏色應更改),則直到完全手動刷新頁面后,該事件才完全或完全不呈現。
誰能告訴我如何解決這個問題? 我嘗試過調用re-render,eventRender和日歷文檔中的函數的每種組合,但是還沒有破解神奇的方法。
謝謝。
彼得
您的問題的解決方法在https://github.com/parhelium/testFullCalendar中 。
首先,需要引用Calendar實例
calendar = $('#calendar').fullCalendar({...}).data().fullCalendar;
使用Requests.find()的函數可以與Deps.autorun包裝在一起,以便在每次Requests集合更新時重新運行它:
Template.packLayout.rendered = function(){
calendar = $('#calendar').fullCalendar({
dayClick:function( date, allDay, jsEvent, view ) {
Requests.insert({title:'Request',start:date,end:date,color:'red',className:'todo'});
Session.set('lastMod',new Date());
},
eventClick:function(reqEvent,jsEvent,view){
Session.set('editingReqEvent',reqEvent.id);
Session.set('showEditEvent',true);
},
eventDrop:function(reqEvent){
Requests.update(reqEvent.id, {$set: {start:reqEvent.start,end:reqEvent.end}});
Session.set('lastMod',new Date());
},
events: function(start, end, callback) {
var events = [];
reqEvents = Requests.find({},{reactive:false});
reqEvents.forEach(function(evt){
event = {id:evt._id,title:evt.title,start:evt.start,end:evt.end,color:evt.color};
events.push(event);
})
callback(events);
},
editable:true,
weekMode: 'liquid',
}).data().fullCalendar;
Deps.autorun(function(){
allReqsCursor = Requests.find().fetch();
console.log("Autorun -> ", allReqsCursor.length)
if(calendar)
calendar.refetchEvents();
})
};
根據最新的Meteor 1.5.2(截至日期)和fullcalendar:fullcalendar
下面的fullcalendar:fullcalendar
是工作代碼,
Template.packLayout.rendered = function(){
calendar = $('#calendar').fullCalendar({
events: function(start, end, timezone, callback) { // timezone added here
// same code
},
editable:true,
weekMode: 'liquid',
}).data().fullCalendar;
this.autorun(function(){ // Deps.autorun replaced here
// same code
})
};
注意:
function( start, end, timezone, callback ) { }
是根據[ https://fullcalendar.io/docs/event_data/events_function/][1]的最新events
方法。
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.