FullCalendar: show reversed list views

前端 未结 3 1076
野的像风
野的像风 2021-01-14 22:10

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

3条回答
  •  星月不相逢
    2021-01-14 22:33

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

    Here is our enhanced version :

    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 = $('');
            }
            blockEvents.append(event);
        });
        reorderedEvents.unshift(blockEvents.children());
        $('.fc-list-table tbody').html(reorderedEvents);
    }
    

提交回复
热议问题