I am using the ui-calendar directive for arshaw's fullcalendar with draggable external events.
I would like to be able to edit the title, start and end through a textbox on a popup dialog without having to drag the event on the calendar itself. I am using ngDialog for the modal and can access the clicked event through the controller's scope. The event title on the calendar responds to the change but the start and end times do not.
When I click save in the modal I pass the updated info to a function ($scope.updateEventInfo
) where I find that specific clientEvent by id, and then update the clientEvent properties.
I then call the fullCalendar updateEvent (.fullCalendar( 'updateEvent', event )
)
The new title will render on calendar but the start and end times do not.
Is there a certain way I need to format or reassign the start and end times?
Controller:
$scope.updateEventInfo = function(clickedEvent) {
var newTitle = clickedEvent.title;
var newStart = clickedEvent._start;
var newEnd = clickedEvent._end;
var clientEvent = uiCalendarConfig.calendars.myCalendar.fullCalendar('clientEvents', clickedEvent._id);
clientEvent[0].title = clickedEvent.title;
clientEvent[0].start = newStart;
clientEvent[0].end = newEnd;
uiCalendarConfig.calendars.festivalLineup.fullCalendar('updateEvent', clickedEvent);
}
$scope.eventSources = [{
events: [],
color: '#428bca',
textColor: 'white',
overlap: false
}]
$scope.uiConfig = {
calendar: {
header: {
left: 'prev,next today',
center: 'title',
right: 'agendaDay,agendaTwoDay,week'
},
defaultView: 'agendaDay',
height: 'auto',
editable: true,
droppable: true,
eventClick: function(clickedEvent) {
$scope.clickedEvent = clickedEvent;
$scope.openModal('EditCalendarEvent');
},
}
};
ngDialog Code:
<div class="modal-container">
<h4>{{clickedEvent.title}}</h4>
<form>
<div class="input-field">
<input id="eventTitle" type="text" ng-model="clickedEvent.title"/>
<label for="eventTitle">Event Title</label>
</div>
<div class="input-field">
<input id="startTime" type="text" ng-model="clickedEvent.start"/>
<label for="startTime">Event Start</label>
</div>
<div class="input-field">
<input id="endTime" type="text" ng-model="clickedEvent.end"/>
<label for="endTime">Event End</label>
</div>
</form>
<button type="button" ng-click="updateEventTimes(clickedEvent)">Save</button>
</div>