Commit c82ab60a authored by Alexander.Trofimov's avatar Alexander.Trofimov

fix subtotal without data

parent c6668704
...@@ -2673,6 +2673,9 @@ CT_pivotTableDefinition.prototype.getRowFieldsCount = function (compact) { ...@@ -2673,6 +2673,9 @@ CT_pivotTableDefinition.prototype.getRowFieldsCount = function (compact) {
} }
return res; return res;
}; };
CT_pivotTableDefinition.prototype.getDataFieldsCount = function () {
return (this.dataFields && this.dataFields.dataField.length) || 0;
};
CT_pivotTableDefinition.prototype.getField = function (arrFields, callback) { CT_pivotTableDefinition.prototype.getField = function (arrFields, callback) {
return arrFields && arrFields.map(callback, this); return arrFields && arrFields.map(callback, this);
}; };
......
...@@ -5033,8 +5033,8 @@ ...@@ -5033,8 +5033,8 @@
}; };
Worksheet.prototype.updatePivotTablesStyle = function (range) { Worksheet.prototype.updatePivotTablesStyle = function (range) {
var pivotTable, pivotRange, styleInfo, style, wholeStyle, cells, j, r, pos, countC, countR, stripe1, stripe2, var pivotTable, pivotRange, styleInfo, style, wholeStyle, cells, j, r, pos, countC, countR, countD, stripe1,
items, item, start = 0, emptyStripe = new Asc.CTableStyleElement(); stripe2, items, item, start = 0, emptyStripe = new Asc.CTableStyleElement();
var dxf, dxfLabels, dxfValues; var dxf, dxfLabels, dxfValues;
for (var i = 0; i < this.pivotTables.length; ++i) { for (var i = 0; i < this.pivotTables.length; ++i) {
pivotTable = this.pivotTables[i]; pivotTable = this.pivotTables[i];
...@@ -5069,6 +5069,7 @@ ...@@ -5069,6 +5069,7 @@
countC = pivotTable.getColumnFieldsCount(); countC = pivotTable.getColumnFieldsCount();
countR = pivotTable.getRowFieldsCount(true); countR = pivotTable.getRowFieldsCount(true);
countD = pivotTable.getDataFieldsCount();
if (0 === countC + countR) { if (0 === countC + countR) {
continue; continue;
...@@ -5133,12 +5134,15 @@ ...@@ -5133,12 +5134,15 @@
} else { } else {
r = item.getR(); r = item.getR();
if (r + 1 !== countC) { if (r + 1 !== countC) {
//ToDo subheading
if (countD && item.t) {
if (0 === r) { if (0 === r) {
dxf = item.t ? style.firstSubtotalColumn : style.firstColumnSubheading; dxf = style.firstSubtotalColumn;
} else if (1 === r % 2) { } else if (1 === r % 2) {
dxf = item.t ? style.secondSubtotalColumn : style.secondColumnSubheading; dxf = style.secondSubtotalColumn;
} else { } else {
dxf = item.t ? style.thirdSubtotalColumn : style.thirdColumnSubheading; dxf = style.thirdSubtotalColumn;
}
} }
} }
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment