本文介绍了FullCalendar:显示反向列表视图的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

如何反转列表视图中的事件,以使具有最未来派日期的事件出现在开头(顶部)?

How can I reverse the events in the list views, so that the event with the most futuristic date appears at the beginning (top)?

推荐答案

@ F.Mora,您的解决方案几乎是完美的,但在我们的案例中,我们添加了一些自定义的className,并且每个标题下都有多个项目.

@F.Mora your solution is almost perfect but in our case we add some custom classNames and have multiple items under each headline.

这是我们的增强版本:

eventAfterAllRender: function(view) {
    var renderedEvents = $('.fc-list-table  tr');
    var reorderedEvents = [];
    var blockEvents = null;
    renderedEvents.map(function(key, event) {
        if ($(event).hasClass('fc-list-heading')) {
            if (blockEvents) {
                reorderedEvents.unshift(blockEvents.children());
            }
            blockEvents = $('<tbody></tbody>');
        }
        blockEvents.append(event);
    });
    reorderedEvents.unshift(blockEvents.children());
    $('.fc-list-table tbody').html(reorderedEvents);
}

这篇关于FullCalendar:显示反向列表视图的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

07-29 12:00