Prevent the user from extending the event to other days

Asked

Viewed 64 times

0

How do I prevent the user from extending the event to other days without interfering with the date editing?

inserir a descrição da imagem aqui

$('#calendario').fullCalendar({

            editable: true, // continuar editável!
            eventLimit: true,
            events: 'eventos.php',
            eventColor: '#dd6777',
.....

2 answers

0

/** desabilita drag-n-drop end resise **/
editable: false,

/** habilita evento drag-n-drop **/
 eventStartEditable  : true,

0

You can check on eventResize of the calendar if the starting day of the selected event is different from the final day of the selection, using the library Moment.js to catch the day. If both are on the same day, it lets edit, if not, it cancels the action.

An example:

$('#calendar').fullCalendar({
    ...
    eventResize: function( event, delta, revertFunc, jsEvent, ui, view ) {
        //Se o dia do inicio da seleção for diferente do dia do final
        //da seleção, ele cancela o resize. Voce pode aplicar essa 
        //lógica para outras edições do usuario, como select por exemplo
        if(moment(event.start).date()!=moment(event.end).date()){
            revertFunc();
        }
    }
});

Browser other questions tagged

You are not signed in. Login or sign up in order to post.