I am trying to add a custom button to calendar navigation bar (print button). I looked at this post Custom Navigation buttons but it was not quite helpful in what I am trying to achieve. I understand how to control the appropriate click event handler just not sure how to add the button. Many thanks in advance for any hints.
(function () {
scheduler.attachEvent("onSchedulerReady", function () {
var navBar = scheduler.$container.querySelector(".dhx_cal_navline");
var button = document.createElement("input");
button.type = "button";
button.value = "Print";
button.classList.add("scheduler-print-button");
button.onclick = function () {
var months = ["January", "February", "March", "April", "May", "June", "July", "August", "September", "October", "November", "December"];
var s = scheduler.getState();
var monthLabel = months[s.date.getMonth()] + ', ' + s.date.getFullYear();
scheduler.exportToPDF({
name: 'calendar-' + s.date.getMonth() + '-' + s.date.getFullYear() + '.pdf',
format: 'A4',
orientation: 'landscape',
zoom: 1,
header: '<h2>Lake County Fairgrounds Reservations for ' + monthLabel + '</h2>'
});
};
var div = document.createElement("div");
div.style = "left: 292px; right: auto;";
div.appendChild(button);
navBar.appendChild(div);
});
})();
Unfortunately, generated PDF file does not render correctly (looks like the styles are not being used). How can I correctly render PDF file using DHTMLX styles? Many thanks in advance.