Skip to content

Commit 006ee14

Browse files
committed
more print support with GridStackWidget.PrintOptions
* fix #701 * we now have print option of pageBreak, hide (don't print) and landscape vs portrait orientation on a PER widget option * switched to CSS grid to get correct layout and holes in the layout * updated print demo with all options
1 parent b192aef commit 006ee14

4 files changed

Lines changed: 181 additions & 122 deletions

File tree

demo/print.html

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -14,9 +14,7 @@
1414
<div class="container-fluid">
1515
<h1>Print Grid Demo</h1>
1616
<p>
17-
This example demonstrates how to use the <code>pageBreak</code> widget option (or the <code>gs-page-break</code> attribute)
18-
to force a new page when printing a grid. <br/>
19-
Notice how Item 3 has <code>pageBreak: true</code> and prints on a new page.
17+
New v13.1+ printing support and widget <code>PrintOptions</code> to control how items are printed. <br/>
2018
</p>
2119
<div>
2220
<a class="btn btn-primary" onClick="window.print()" href="#">Print Page</a>
@@ -38,11 +36,13 @@ <h1>Print Grid Demo</h1>
3836
};
3937

4038
let items = [
41-
{x: 0, y: 0, w: 4, h: 2, content: 'Item 1<br>(Page 1)'},
42-
{x: 4, y: 0, w: 4, h: 1, content: 'Item 2<br>(Page 1)'},
43-
{x: 0, y: 2, w: 12, h: 1, content: 'Item 3<br><strong>(Starts on Page 2)</strong>', pageBreak: true},
44-
{x: 0, y: 3, w: 6, h: 1, content: 'Item 4<br>(Page 2)'},
45-
{x: 6, y: 3, w: 6, h: 1, content: 'Item 5<br>(Page 2)'}
39+
{x: 6, y: 0, w: 4, h: 1, content: 'Item 2<br>(Page 1)'},
40+
{x: 1, y: 0, w: 4, h: 2, content: 'Item 1<br>(Page 1)'}, // verify domSort is working
41+
{x: 0, y: 2, w: 12, h: 1, content: 'Item 3<br><strong>(Starts on Page 2)</strong>', print: { pageBreak: true } },
42+
{x: 0, y: 3, w: 6, h: 1, content: 'Item 4<br>(Not Printed)', print: { hide: true } },
43+
{x: 6, y: 3, w: 6, h: 1, content: 'Item 5'},
44+
{x: 0, y: 4, w: 12, h: 2, content: 'Item 6<br>(Starts on Landscape Page)', print: { pageBreak: true, orientation: 'landscape' } },
45+
{x: 0, y: 6, w: 12, h: 2, content: 'Item 7<br>(Starts on Portrait Page)', print: { pageBreak: true, orientation: 'portrait' } }
4646
];
4747

4848
let grid = GridStack.init(options);

0 commit comments

Comments
 (0)