2016-03-21 13 views
-1

私はdrblue:fullcalendarを使用しています。ディスプレイは正常に動作しますが、何らかのイベントを処理することはできません。私は別のものを試しました。いずれか、クライアントまたはサーバなしのログエントリにmeteor fullcalendarはイベントに全く反応しません

Template.Schedule.helpers({ 
    calendarOptions: { 
     // Standard fullcalendar options 
     schedulerLicenseKey: 'CC-Attribution-NonCommercial-NoDerivatives', 
     slotDuration: '01:00:00', 
     minTime: '07:00:00', 
     maxTime: '22:00:00', 
     lang: 'en', 
     defaultView: 'agendaWeek', 
     contentHeight: 500, 
     firstDay: 1, 
     timeFormat: 'HH:mm', 
     timezone: 'UTC', 
     selectable: true, 
     // Function providing events reactive computation for fullcalendar plugin 
     events: function(start, end, timezone, callback){ 

      var events = []; 

       Assignments.find().map(function(doc){ 

        var startTimeHours = Number(doc.time.substr(0, 2)); 
        var startTimeMinutes = Number(doc.time.substr(3, 2)); 

        var startDateTime = new Date(doc.date); 
        startDateTime.setHours(startDateTime.getHours() + startTimeHours); 
        startDateTime.setMinutes(startDateTime.getMinutes() + startTimeMinutes); 

        var endDateTime = new Date(doc.date); 

        var effort = doc.state == 'finished' ? doc.realEffort : doc.effort; 

        endDateTime.setHours(startDateTime.getHours() + effort); 
        endDateTime.setMinutes(startDateTime.getMinutes()); 

        var getColorForState = function(state) 
        { 
         switch(state) 
         { 
          case 'finished': return '#00bb00'; 
         } 
         return '#1197C1'; 
        }; 

        var getBorderColorForState = function(state) 
        { 
         switch(state) 
         { 
          case 'finished': return '#009900'; 
         } 

         return '#004781'; 
        }; 

        return{ 
        id: doc.title, 
        start: startDateTime, 
        end: endDateTime, 
        title: doc.title, 
        backgroundColor: getColorForState(doc.state), 
        borderColor: getBorderColorForState(doc.state) 
       } 
      }).forEach(function(event){ 

       events.push(event); 
      }); 
callback(events); 
     }, 
     // Optional: id of the calendar 
     id: "calendar1", 
     // Optional: Additional classes to apply to the calendar 
     addedClasses: "col-md-12" 
     // Optional: Additional functions to apply after each reactive events computation 

    } 
    }); 

Template.Schedule.events({ 
    loading: function(isLoading, view){ 
     console.log('hi'); 
    } 

}); 

ませんJSエラー:次のコードスニペットでは、私は、ロードイベントを試してみました。私もdayClick、selectとclickEventを試しましたが、ログエントリはありません。もし私がそれにalertを置くと、私は何も受け取りません。

答えて

0

詳しい情報や詳細が必要な場合は、なぜそれを提出してください、なぜdownvoted理由はわかりません。

とにかく、私はそれを解決することができました。そこにいくつかの「間違った」コードが出ていたと私はちょうどのオプションに対応するイベントを追加するとき、それは動作しますが、任意の例を見つけるが、なかった、すなわち:

Template.Schedule.helpers({ 
    calendarOptions: { 
     // all the various options 
     eventClick: function(event, jsEvent, view){ 
      alert(event.title + "\r\n\r\n" + event.description); 
     }, 
関連する問題