|
|
@@ -69,19 +69,34 @@
|
|
|
}
|
|
|
}
|
|
|
|
|
|
- function buildTable(data,columns) {
|
|
|
- var out = "<table><thead><tr>";
|
|
|
- for(var h = 0; h < columns.length; h++) {
|
|
|
- if(!columns[h].printIgnore) {
|
|
|
- out += ("<th>"+columns[h].title+"</th>");
|
|
|
+ function buildTable(data, columnsArray) {
|
|
|
+ var out = "<table><thead>";
|
|
|
+ for(var k = 0; k < columnsArray.length; k++) {
|
|
|
+ var columns = columnsArray[k];
|
|
|
+ out += "<tr>";
|
|
|
+ for(var h = 0; h < columns.length; h++) {
|
|
|
+ if (!columns[h].printIgnore) {
|
|
|
+ out += "<th ";
|
|
|
+ if (columns[h].rowspan) {
|
|
|
+ out += (" rowspan='" + columns[h].rowspan + "'");
|
|
|
+ }
|
|
|
+ if (columns[h].colspan) {
|
|
|
+ out += (" colspan='" + columns[h].colspan + "'");
|
|
|
+ }
|
|
|
+ out += (">" + columns[h].title + "</>");
|
|
|
+ }
|
|
|
}
|
|
|
+ out += "</tr>";
|
|
|
}
|
|
|
- out += "</tr></thead><tbody>";
|
|
|
+ out += "</thead><tbody>";
|
|
|
for(var i = 0; i < data.length; i++) {
|
|
|
out += "<tr>";
|
|
|
- for(var j = 0; j < columns.length; j++) {
|
|
|
- if(!columns[j].printIgnore) {
|
|
|
- out += ("<td>"+ formatValue(data[i], i, columns[j])+"</td>");
|
|
|
+ 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 += ("<td>" + formatValue(data[i], i, columns[j]) + "</td>");
|
|
|
+ }
|
|
|
}
|
|
|
}
|
|
|
out += "</tr>";
|
|
|
@@ -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();
|