Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -4,4 +4,4 @@ dist/
yarn.lock
coverage/
.vscode
package-lock.json
package-lock.json
4 changes: 2 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -39,8 +39,8 @@
"production": "webpack --mode production --progress --hide-modules",
"coverage": "open coverage/lcov-report/index.html",
"coveralls": "cat coverage/lcov.info | ./node_modules/coveralls/bin/coveralls.js",
"start": "webpack-dev-server --public http://localhost:8080/test/manual --open",
"standard:fix": "standard --fix"
"start": "webpack-dev-server --public http://localhost:8080/test/manual --open",
"standard:fix": "standard --fix"
},
"author": "Rodrigo Vieira <[email protected]>",
"standard": {
Expand Down
4 changes: 3 additions & 1 deletion src/js/init.js
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ export default {
headerStyle: 'font-weight: 300;',
maxWidth: 800,
properties: null,
rowsBefore: null,
gridHeaderStyle: 'font-weight: bold; padding: 5px; border: 1px solid #dddddd;',
gridStyle: 'border: 1px solid lightgray; margin-bottom: -1px;',
showModal: false,
Expand Down Expand Up @@ -65,9 +66,10 @@ export default {
break
case 'object':
params.printable = args.printable
params.rowsBefore = args.rowsBefore
params.fallbackPrintable = typeof args.fallbackPrintable !== 'undefined' ? args.fallbackPrintable : params.printable
params.fallbackPrintable = params.base64 ? `data:application/pdf;base64,${params.fallbackPrintable}` : params.fallbackPrintable
for (var k in params) {
for (const k in params) {
if (k === 'printable' || k === 'fallbackPrintable') continue

params[k] = typeof args[k] !== 'undefined' ? args[k] : params[k]
Expand Down
5 changes: 5 additions & 0 deletions src/js/json.js
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,11 @@ function jsonToHTML (params) {
htmlData += '<thead>'
}

// Add rows before normal header
if (params.rowsBefore) {
htmlData += params.rowsBefore
}

// Add the table header row
htmlData += '<tr>'

Expand Down
3 changes: 2 additions & 1 deletion test/manual/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -85,6 +85,7 @@

printJS({
printable: data,
rowsBefore: '<tr><th colspan=2>xxxxxx</th></tr>',
properties: [
{
field: 'test1',
Expand Down Expand Up @@ -305,4 +306,4 @@ <h2>Form Elements</h2>
</div>
</section>
</body>
</html>
</html>