在开始日期和结束日期之前以FullCalendar订购事件



我如何在开始日期之前首先在Fullcalendar中订购事件?

示例:

  • 首先开始的事件将在顶部显示,然后稍后开始的事件将
  • 如果两个事件的开始日期相同,则按结束日期订购IE一个事件将首先显示,然后是一个稍后结束的事件。

日历显示事件顺序

var args = jQuery.parseJSON(emCalendarArgs);
var Jobj = args.events;
// Setup FullCalendar
(function() {
  //var language = jQuery('#pg_lang').val();
  //alert(language+ 'dsfsd');
  var date = new Date();
  var d = date.getDate();
  var m = date.getMonth();
  var y = date.getFullYear();
  var language = langg;
  var mn_text, week_text, day_text, list_text;
  //alert(mn_text);
  var args = jQuery.parseJSON(emCalendarArgs);
  var Jobj = args.events;
  console.log(Jobj);
  jQuery('#events-full-calendar').fullCalendar({
    allDaySlot: false,
    editable: true,
    lang: 'he',
    handleWindowResize: true,
    eventOrder: 'start,end',
    header: {
      left: 'today prev,next',
      center: 'title',
      right: 'month,basicWeek,basicDay'
    },
    buttonText: {
      month: mn_text,
      week: week_text,
      day: day_text
    },
    eventLimit: {
      'month': 3, // adjust to 4 only for months
      'default': false // display all events for other views
    },
    axisFormat: 'HH:mm',
    timeFormat: {
      agenda: 'H:mm{ - h:mm}'
    },
    slotEventOverlap: false,
    events: Jobj,
    timeFormat: 'H:mm',
  });
}());

我找到了一个解决方案。对于任何其他寻找解决方案的人,我更改了fullcalendar.js的功能:

compareSegs: function(seg1, seg2) { return seg1.eventStartMS - seg2.eventStartMS || // earlier events go first seg2.eventDurationMS - seg1.eventDurationMS || // tie? longer events go first seg2.event.allDay - seg1.event.allDay || // tie? put all-day events first (booleans cast to 0/1) compareByFieldSpecs(seg1.event, seg2.event, this.view.eventOrderSpecs); } 

to:

compareSegs: function(seg1, seg2) {
        if(this.view.name=="basicWeek" || this.view.name=="month" || this.view.name=="basicDay"){ // ordering events by color in ListView
        return seg2.event.allDay - seg1.event.allDay || // tie? put all-day events first (booleans cast to 0/1)
            compareByFieldSpecs(seg1.event, seg2.event, this.view.eventOrderSpecs);
        }
        else{
            return seg1.eventStartMS - seg2.eventStartMS || // earlier events go first
                        seg2.eventDurationMS - seg1.eventDurationMS || // tie? longer events go first
                        seg2.event.allDay - seg1.event.allDay || // tie? put all-day events first (booleans cast to 0/1)
                        compareByFieldSpecs(seg1.event, seg2.event, this.view.eventOrderSpecs);
        }
    }

并在FullCalendar函数中使用以下代码

eventOrder: 'start, end' 

在我的Fullcalendar呼叫中

相关内容

  • 没有找到相关文章

最新更新