FullCalendar: show reversed list views

前端 未结 3 1093
野的像风
野的像风 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:43

    For anyone still looking for this, inverted event lists using jquery:

    eventAfterAllRender: function(view) {
        var eventosRendered = $('#timeline tr');
        var eventosInversa = [];
        var headingPendiente = null;
        eventosRendered.map(function(key, evento) {
            switch(evento.className) {
                case 'fc-list-heading':
                    if (headingPendiente) {
                        eventosInversa.unshift(headingPendiente);
                    }
                    headingPendiente = evento;
                    break;
                case 'fc-list-item':
                    eventosInversa.unshift(evento);
                    break;
            }
        });
        eventosInversa.unshift(headingPendiente);
    
        $('#timeline tbody').append(eventosInversa);
    }
    

提交回复
热议问题