Empresas
Empregos
  • Sobre nós
  • Soluções
    • Publicação de vagas
      Publique sua vaga e receba candidatos qualificados em 48h.
    • Avaliações de candidatos
      Mais de 500 testes técnicos e psicológicos, mais anti-fraude.
    • Headhunting
      Busca executiva personalizada do início ao fim.
    • Folha de Pagamento + EOR
      Dispersão de folha e EOR em mais de 15 países da LATAM.
  • Preços
  • Empregos

0

207
Visualizações
Make fullcalendar event filtering persistant between re-renderings

I have a fullcalendar that initially display all events, but i'm usign a select to filter the events, the filter works well, however when the callendar re-render because I moved to the next month it shows all events again. This is my callendar initialization

var calendarEl = document.getElementById('calendar');
    var calendar = new FullCalendar.Calendar(calendarEl,{
        titleFormat:{
            hour12: true
        },
        locale: '{{ (App::getLocale() == "es") ? "es" : "en" }}',
        bootstrapFontAwesome: false,
        headerToolbar: {
            left: 'prev,next today',
            center: 'title',
            right: 'dayGridMonth,timeGridWeek,timeGridDay,listWeek'
        },
        eventTimeFormat: {
            hour: '2-digit',
            minute: '2-digit',
            hour12: true
        },
        events:"{{ route('schedules.show', 0) }}"
    });

    calendar.render();

And this my calendar filtering:

        $('#select_coach').change(function(){

            var coach_id = $('#select_coach').val();

            source = "{{url('/schedules/show/')}}"+'/'+coach_id;

            events = calendar.getEvents();
            events.forEach(event => { event.remove()});
            calendar.addEventSource(source);

       })
about 4 years ago · Juan Pablo Isaza
1 Respostas
Responde à pergunta

0

With the fullcalendar method getEventSources() I got the original source then I put it in a variable let sources = calendar.getEventSources(); then I called the remove() method on the variable now I only have one source so everytime it re-render only use the last source.

let events = calendar.getEvents();
events.forEach(event => { event.remove()});
let sources = calendar.getEventSources();
sources[0].remove();
calendar.addEventSource(source);
about 4 years ago · Juan Pablo Isaza Relatório
Responde à pergunta
Encontrar trabalhos remotos

Descubra a nova forma de encontrar um emprego!

melhores empregos
Principais categorias de trabalho
Empresas
Postar vaga Preços Comercial
Jurídico
Termos e Condições Política de privacidade
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomende algumas ofertas para mim
Preciso de ajuda