From 9116a86c7cedeeedefb02bafb4060efdae8689f0 Mon Sep 17 00:00:00 2001 From: riggzh Date: Wed, 10 Jan 2018 16:26:47 +0800 Subject: [PATCH] Complex Table can't print --- src/extensions/print/bootstrap-table-print.js | 35 +++++++++++++------ 1 file changed, 25 insertions(+), 10 deletions(-) diff --git a/src/extensions/print/bootstrap-table-print.js b/src/extensions/print/bootstrap-table-print.js index 97a03f4989..aab0a7ffba 100644 --- a/src/extensions/print/bootstrap-table-print.js +++ b/src/extensions/print/bootstrap-table-print.js @@ -69,19 +69,34 @@ } } - function buildTable(data,columns) { - var out = ""; - for(var h = 0; h < columns.length; h++) { - if(!columns[h].printIgnore) { - out += (""); + function buildTable(data, columnsArray) { + var out = "
"+columns[h].title+"
"; + for(var k = 0; k < columnsArray.length; k++) { + var columns = columnsArray[k]; + out += ""; + for(var h = 0; h < columns.length; h++) { + if (!columns[h].printIgnore) { + out += ""; } - out += ""; + out += ""; for(var i = 0; i < data.length; i++) { out += ""; - for(var j = 0; j < columns.length; j++) { - if(!columns[j].printIgnore) { - out += (""); + for(var l = 0; l < columnsArray.length; l++) { + var columns = columnsArray[l]; + for(var j = 0; j < columns.length; j++) { + if (!columns[j].printIgnore && columns[j].field) { + out += (""); + } } } out += ""; @@ -122,7 +137,7 @@ var doPrint = function (data) { data=filterRows(data,getColumnFilters(that.options.columns)); data=sortRows(data,that.options.printSortColumn,that.options.printSortOrder); - var table=buildTable(data,that.options.columns[0]); + var table=buildTable(data,that.options.columns); var newWin = window.open(""); newWin.document.write(that.options.printPageBuilder.call(this, table)); newWin.print();
" + columns[h].title + ""); + } } + out += "
"+ formatValue(data[i], i, columns[j])+"" + formatValue(data[i], i, columns[j]) + "