How to show event details on click of day in full calendar

前端 未结 3 2064
一生所求
一生所求 2020-12-09 22:38

Hi everyone I have events array, on click of day I want to show event details in another panel. I have array with array within array format, I am not getting how to render t

3条回答
  •  不思量自难忘°
    2020-12-09 23:15

    Ahaa! Finally I found the solution to render events on dayClick. There is something called clientEvents object that allows us to fetch events inside any full calendar actions (say dayClick, eventClick etc) I used that fucntion to render my events, here is my working demo...

    and the dayClick code which I was eagerly searching is below

    dayClick: function(date, allDay, jsEvent, view) {
      $('#calendar').fullCalendar('clientEvents', function(event) {
        // match the event date with clicked date if true render clicked date events
        if (moment(date).format('YYYY-MM-DD') == moment(event._start).format('YYYY-MM-DD')) {
          // do your stuff here
          console.log(event.title);
    
          // if you have subarray i mean array within array then 
          console.log(event.subarray[0].yoursubarrayKey);
        }
      }
    }
    

提交回复
热议问题