mirror of
https://github.com/IfcOpenShell/IfcOpenShell.git
synced 2026-09-24 19:09:58 +00:00
add print button for gantt chart
This commit is contained in:
@@ -81,6 +81,7 @@ function addGanttElement(blenderId, tasks, WorkSched, filename) {
|
|||||||
const ganttTitle = $("<h3></h3>")
|
const ganttTitle = $("<h3></h3>")
|
||||||
.attr("id", "title-" + blenderId)
|
.attr("id", "title-" + blenderId)
|
||||||
.text(filename)
|
.text(filename)
|
||||||
|
.addClass("no-print")
|
||||||
.css("margin-bottom", "10px");
|
.css("margin-bottom", "10px");
|
||||||
|
|
||||||
const ganttDiv = $("<div></div>")
|
const ganttDiv = $("<div></div>")
|
||||||
@@ -119,6 +120,37 @@ function addGanttElement(blenderId, tasks, WorkSched, filename) {
|
|||||||
}
|
}
|
||||||
g.setEditable(true);
|
g.setEditable(true);
|
||||||
g.Draw();
|
g.Draw();
|
||||||
|
|
||||||
|
let printButton = $("<button>", {
|
||||||
|
id: "print-schedule",
|
||||||
|
html: "Print",
|
||||||
|
class: "no-print",
|
||||||
|
});
|
||||||
|
|
||||||
|
printButton.on("click", function () {
|
||||||
|
g.setEditable(false);
|
||||||
|
g.setTotalHeight("");
|
||||||
|
g.Draw();
|
||||||
|
var values = "297,210".split(",");
|
||||||
|
let css =
|
||||||
|
"@media print {\n" +
|
||||||
|
" @page {\n" +
|
||||||
|
" size: " +
|
||||||
|
values[0] +
|
||||||
|
"mm " +
|
||||||
|
values[1] +
|
||||||
|
"mm;\n" +
|
||||||
|
" }\n" +
|
||||||
|
" /* Make all text black */\n" +
|
||||||
|
" body, p, span, h1, h2, h3, h4, h5, h6, div, a, li, td, th, * {\n" +
|
||||||
|
" color: black !important;\n" +
|
||||||
|
" }\n" +
|
||||||
|
"}";
|
||||||
|
g.printChart(values[0], values[1], css);
|
||||||
|
g.setTotalHeight(900);
|
||||||
|
g.Draw();
|
||||||
|
});
|
||||||
|
ganttContainer.append(printButton);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Function to update gantt and filename
|
// Function to update gantt and filename
|
||||||
|
|||||||
Reference in New Issue
Block a user