View week only with Fullcalendar events

3

The fullcalendar has the prev and next button that moves forward and returns the weeks, if you get ahead it will show the weeks infinitely, if you return too.

I need a function that allows you to display only the weeks that contain marked events.

For example: If I have an event on 02/15/2014 and another event on 08/20/2015, the prev and next buttons will only be able to switch over these two weeks.

Does anyone know of a function that allows you to do this in fullcalendar?

I tried to look for some function in the docs of fullcalendar site, but I did not find any of this, follow link: link

    
asked by anonymous 17.12.2015 / 12:38

1 answer

4

Follow the code below:

It follows js that picks up the start date and end date, and limits the prv and next arrows of the fullcalendar:

viewRender: function(view,element) {
      var now = moment('<?php print $eventos_agenda[0]->data_clicada ?>');
        var end = moment('<?php print $eventos_agenda[$final]->data_clicada ?>');
                    if ( end < view.end) {
                       $("#botao_passa").addClass('disabled');
                    }
                    else {
                       $("#botao_passa").removeClass('disabled');
                    }
                    if ( view.start < now) {
                       $("#botao_volta").addClass('disabled');
                    }
                    else {
                       $("#botao_volta").removeClass('disabled');
                    }
                },
    
27.01.2016 / 17:26