I have a scenario where I have all the resources to be displayed in a dropdown list which is a multi-select dropdown.
I want to add a resource to the calendar when the resource is selected in the dropdown.
Here is my code for the calendar:
var source = '/Request/GetBookingInfo?envid=0';
var resources = '/Request/GetEnvironments?envid=0';// + $('#ddlenv').val();
$('#calendar').fullCalendar({
resourceAreaWidth: 230,
editable: true,
aspectRatio: 1.5,
scrollTime: '00:00',
header: {
left: 'promptResource today prev,next',
center: 'title',
right: 'timelineDay,timelineThreeDays,timelineWeek,timelineMonth,timelineQuarter,timelineYear'
},
defaultView: 'timelineDay',
views: {
timelineThreeDays: {
type: 'timeline',
duration: { days: 3 }
},
timelineWeek: {
type: 'timeline',
duration: { days: 7 }
},
timelineMonth: {
type: 'timeline',
duration: { days: 30 }
},
timelineQuarter: {
type: 'timeline',
duration: { days: 90 }
},
timelineYear: {
type: 'timeline',
duration: { days: 365 }
}
},
resourceLabelText: 'Rooms',
resources:resources,
events: source
});
//Dropdown change event
$('#ddlenv').on('change', function () {
var resources = '/controller/actiontogetresources?envid=' + $('#ddlenv').val();
var source = '/controller/actiontogetevents?envid=0';
newSource = '/controller/actiontogetevents?envid=' + $('#ddlenv').val();
var newResources = '/controller/actiontogetresources?envid=' + $('#ddlenv').val();
resources = newResources;
$('#calendar').fullCalendar('removeEventSource', source)
$('#calendar').fullCalendar('refetchEvents')
$('#calendar').fullCalendar('addEventSource', newSource)
$('#calendar').fullCalendar('refetchEvents');
source = newSource;
var resour = {
url: '/Request/GetEnvironments',
type: 'POST',
data: {
envid: $('#ddlenv').val()
}
}
$('#calendar').fullCalendar('removeResource', resour);
$('#calendar').fullCalendar('addResource', resour );
});
How can I call the action by passing the dropdown selected ID and bind the resource to the calendar?