Hi Dan,
I apologize if this is a bit of a code dump, but I'm not sure how else to show you what I'm doing:
HTML:
<daypilot-scheduler id="dp" publish-as="vm.scheduler">
</daypilot-scheduler>
Configure the scheduler:
vm.scheduler.theme = 'briteplan';
vm.scheduler.businessBeginsHour = 8;
vm.scheduler.businessEndsHour = 17;
vm.scheduler.dynamicEventRenderingMargin = 20;
vm.scheduler.progressiveRowRendering = true;
vm.scheduler.heightSpec = 'Max';
vm.scheduler.height = 500;
vm.scheduler.rowMarginBottom = 20;
vm.scheduler.dynamicEventRenderingCacheSweeping = true;
vm.scheduler.eventMovingStartEndEnabled = true;
vm.scheduler.eventResizingStartEndEnabled = true;
vm.scheduler.timeRangeSelectingStartEndEnabled = false;
vm.scheduler.scale = 'Day';
vm.scheduler.days = vm.daysInCurrentMonth * 2;
vm.scheduler.cellDuration = 1440;
vm.scheduler.cellWidth = 60;
vm.scheduler.eventHeight = 30;
vm.scheduler.startDate = moment().subtract(1, 'months').startOf('month').format(appConfig.alternativeDateFormat);
vm.scheduler.showNonBusiness = true;
vm.scheduler.timeHeaders = [
{ groupBy: 'Month' },
{ groupBy: 'Cell', format: 'ddd d' }
];
vm.scheduler.events = [];
vm.scheduler.events.list = [];
vm.scheduler.separators = [
{ color: 'Red', location: moment().format(appConfig.alternativeDateFormat), layer: 'BelowEvents' }
];
vm.scheduler.contextMenu = new DayPilot.Menu({
items: [
{
// SHOW THE EVENT DETAILS
text: 'Show details',
onclick: function () {
viewEventModal(this.source.data);
}
},
{
// EDIT THE EVENT
text: 'Edit event',
onclick: function () {
addEditEventModal(this.source.data);
}
},
{ text: '-' },
{
// DELETE THE SELECTED BOOKING EVENT
text: 'Delete',
items: [
{
text: 'Yes', onclick: function () {
vm.scheduler.events.remove(this.source);
bookingApi.removeBookingById(this.source.id())
.then(function (result) {
if (result) {
//vm.scheduler.message('booking event removed...');
// inform the user of what happened
toastr['success']('booking event removed...', 'Resource Booking Event');
}
});
}
},
{ text: 'Cancel', onclick: function () { return; } }
]
}
]
});
vm.scheduler.bubble = new DayPilot.Bubble({
onLoad: function (args) {
args.html = args.source.bubbleHtml();
}
});
//ON-BEFORE-EVENT-RENDER
vm.scheduler.onBeforeEventRender = onBeforeEventRender;
//ON-BEFORE-CELL-RENDER
vm.scheduler.onBeforeCellRender = onBeforeCellRender;
//ON-EVENT-FILTER
vm.scheduler.onEventFilter = onEventFilter;
//ON-ROW-FILTER
vm.scheduler.onRowFilter = onRowFilter;
//ON-TIME-RANGE-SELECTED
vm.scheduler.onTimeRangeSelected = onTimeRangeSelected;
//ON-EVENT-CLICKED
vm.scheduler.onEventClicked = onEventClicked;
//ON-EVENT-MOVE
vm.scheduler.onEventMoved = onEventMoved;
//ON-EVENT-RESIZED
vm.scheduler.onEventResized = onEventResized;
vm.scheduler.treePreventParentUsage = true;
vm.scheduler.init();
Load the resources:
// clear any existing data
vm.scheduler.events.list = [];
vm.scheduler.resources = _.map(vm.activeBookingModels,
function (item) {
return { name: item.FullName, id: item.Id }
});
Loading the events:
var bookings = flatten ? _.map(bookingArgs, 'Bookings') : bookingArgs;
var mappedEvents = _.map(flatten ? _.flattenDeep(bookings) : bookingArgs,
function (item) {
var e = {
start: new DayPilot.Date(item.FromDate.format(appConfig.alternativeDateFormat))
.addHours(vm.scheduler.businessBeginsHour),
end: new DayPilot.Date(item.ToDate.format(appConfig.alternativeDateFormat))
.addHours(vm.scheduler.businessEndsHour),
id: item.Id,
resource: item.ResourceID,
text: item.Description,
bubbleHtml: 'Hours: ' + item.Hours,
meta: item
};
return e;
});
_.forEach(mappedEvents, function (value) {
vm.scheduler.events.list.push(value);
});
vm.scheduler.eventHoverHandling = 'Bubble';
vm.scheduler.update();
Can you perhaps see anything?
Thanks Dan