FullCalendar如何在列表视图中检测最后一行事件

时间:2018-08-08 10:04:10

标签: jquery fullcalendar

我需要在全日历的列表视图中检测到同一事件的最后一行。

我需要它仅对最后一行(事件大于1天)显示不同的测试。

请参见图片示例:enter image description here

这是我正在使用的代码,但我不知道如何检测最后一行:

eventRender: function(event, element, view) {

        if ( view.type == "listYear" || view.type == "listMonth" ) {

          //i want to show it if last row of the event

          var duration = "<br>Durata: " + event.duration;

          // CODE TO IMPLEMENT
          //if ( NOT LAST ROW OF SAME EVENT ) {

            //duration = "";

          //}
          //END CODE TO IMPLEMENT

            var title = element.find( '.fc-list-item-title' );
            title.html( event.title + duration );

        }

    },
  events: [{
    title: 'Event 1',
    start: '2016-04-26 14:00',
    end: '2016-04-27 09:00',
  duration: '19 hours'
  },
{
    title: 'Event 2 (1 day)',
    start: '2016-04-26 14:00',
    end: '2016-04-26 17:00',
  duration: '3 hours'
  }]

jsfiddle实现:http://jsfiddle.net/s7t2bc12/111/

0 个答案:

没有答案