diff --git a/.gitignore b/.gitignore index e420f75..45ea2fa 100644 --- a/.gitignore +++ b/.gitignore @@ -4,4 +4,4 @@ dist/ yarn.lock coverage/ .vscode -package-lock.json \ No newline at end of file +package-lock.json diff --git a/package.json b/package.json index 352da94..225fb7d 100644 --- a/package.json +++ b/package.json @@ -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 ", "standard": { diff --git a/src/js/init.js b/src/js/init.js index bfda427..edb2526 100644 --- a/src/js/init.js +++ b/src/js/init.js @@ -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, @@ -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] diff --git a/src/js/json.js b/src/js/json.js index 9aa2a5a..ef83f11 100644 --- a/src/js/json.js +++ b/src/js/json.js @@ -56,6 +56,11 @@ function jsonToHTML (params) { htmlData += '' } + // Add rows before normal header + if (params.rowsBefore) { + htmlData += params.rowsBefore + } + // Add the table header row htmlData += '' diff --git a/test/manual/index.html b/test/manual/index.html index 0b606ec..ffa44fe 100644 --- a/test/manual/index.html +++ b/test/manual/index.html @@ -85,6 +85,7 @@ printJS({ printable: data, + rowsBefore: 'xxxxxx', properties: [ { field: 'test1', @@ -305,4 +306,4 @@

Form Elements

- \ No newline at end of file +