Databases Reference
In-Depth Information
The
options
object is defined next, more to serve as a reminder of which properties exist than to set
any defaults. Default value logic is maintained in the attribute defaults as well as the PL/SQL code.
options: {
theme: null,
ajaxIdentifier: null
},
The
create
function will be invoked automatically one time when the widget is first initialized. In
the beginning of the function, a local variable is declared to store a reference to
this
. In the context of a
widget method,
this
represents the widget object. This is done to allow access to the object later via
closure in JavaScript. FullCalendar, which does all the heavy lifting in this plug-in, is initialized at this
time.
create: function() {
var uiw = this;
$('#' + uiw.element.attr('id') + ' FULL CALENDAR').fullCalendar({
editable: false,
theme: uiw.options.theme !== null,
events: function(start, end, callback){uiw.getDates(start, end, callback)},
ignoreTimeZone: true,
weekends: true,
header: {
left: 'today prev,next',
center: 'title',
right: 'agendaDay agendaWeek month'
},
viewDisplay: function(view) {
uiw.element.trigger('calendarviewdisplay');
}
});
To make sure that the plug-in is compatible with the standard APEX framework events, a function is
bound to the
apexrefresh
event that will refresh events displayed in the calendar.
uiw.element.bind('apexrefresh', function() {
$('#' + uiw.element.attr('id') + ' FULL CALENDAR').fullCalendar('refetchEvents');
});
},
The
getDates
method is responsible for making the Ajax request to bring new dates to the calendar
when requested. Notice that the Ajax function is called by referencing the
ajaxIdentifier
value that was
passed through from the PL/SQL code. Also,
apexbeforerefresh
and
apexafterrefresh
are triggered at
the appropriate times to allow dynamic actions to work with them.
getDates: function(start, end, callback) {
var uiw = this;
uiw.element.trigger('apexbeforerefresh');
$.ajax({