Issue
I'm using Angular JS with fullCalendar and I'm trying to change the value editable of my calendar when I click on a button. It seams pretty simple but for some reason nothing is working.
I got this code to set the value editable in the first place :
var Calendar = $('#calendar').fullCalendar({
/*...*/
events: events,
editable: $scope.editable,
droppable: true,
allDayDefault: false,
/*...*/
});
This part seams to be OK since my $scope.editable is false by default and the calendar does not allows any modification.
I'm using a function in Angular JS to change the value of my $scope.editable value to its opposite using this function :
$scope.edit = function () {
$scope.editable = !$scope.editable;
};
Of course it does not change the value in FullCalendar so i'm wondering what to do. I've tried a few things, like changing the value and then rerendering or refetching events but nothings seams to works.
$scope.edit = function () {
$scope.editable = !$scope.editable;
Calendar.fullCalendar({editable: $scope.editable});
Calendar.fullCalendar('refetchEvents');
};
Any ideas ?
Edit
I have acheived this in the past by changing the value, destroying the calendar and then building it again, i don't think this approach is the most effective. I would like to keep my calendar the way it is and just allows edition.
Solution
Turns out I did not do enough research. I found out that since FullCalendar 2.9.0 it is possible to dynamicly change options. using Calendar.fullCalendar('option', option, value);
Here is a full link with the complete documentation if anyone need the info.
Answered By - Nicolas
0 comments:
Post a Comment
Note: Only a member of this blog may post a comment.