i having 2 dates in full calendar , in '28-04-2015' , '6-05-2015'. events having , events should drop in between particular dates. in other dates event should not drop in full calendar.
you can use eventconstraint
limits event dragging , resizing windows of time.
$('#calendar').fullcalendar({ eventconstraint: { start: '2015-06-15',//change dates according needs end: '2015-06-29' }, events: [ { title: 'all day event', start: '2015-06-01' }, { title: 'long event', start: '2015-06-07', end: '2015-06-10' } ], });
the above function allow drop events between 2015-06-15
2015-06-29
can change dates according needs.
alternatively can store restricted dates in event data custom variable, , check while event dropped.
$('#calendar').fullcalendar({ events: [ { title: 'all day event', start: '2015-06-01', end: '2015-06-01', restricteddates: ['2015-06-13', '2015-06-14', '2015-06-15'] }, { title: 'long event', start: '2015-06-07', end: '2015-06-07', restricteddates: ['2015-06-15', '2015-06-16', '2015-06-17'] } ], eventdrop: function( event, delta, revertfunc, jsevent, ui, view ) { if(!jquery.inarray(event.start.format('yyyy-mm-dd'), event.restricteddates)) { alert('restricted area.'); revertfunc(); } else { alert('free access'); } } });
the second solution bit more flexible can restrict dates individual events, @ end of day choice yours.
Comments
Post a Comment