Commit 9c4fed69 authored by Alexander.Trofimov's avatar Alexander.Trofimov

fix update row filds without compact mode

parent efa52bd0
......@@ -2665,7 +2665,7 @@ CT_pivotTableDefinition.prototype.getRowFieldsCount = function (compact) {
if (compact) {
this.getField(this.rowFields.field, function (element, i) {
if (i !== l - 1) {
var field = t.pivotFields.pivotField[element.x || 0];
var field = t.pivotFields.pivotField[element.asc_getIndex()];
res -= (field && false !== field.compact) ? 1 : 0;
}
});
......@@ -6410,7 +6410,7 @@ CT_Field.prototype.toXml = function(writer, name) {
writer.WriteXmlNodeEnd(name, true, true);
};
CT_Field.prototype.asc_getIndex = function () {
return this.x;
return this.x || 0;
};
function CT_I() {
//Attributes
......
......@@ -4924,7 +4924,7 @@
}
};
Worksheet.prototype._updatePivotTable = function (pivotTable, cleanRanges) {
var pos, cells, index, i, j, v, indexField, cacheIndex, sharedItem;
var pos, cells, index, i, j, v, field, indexField, cacheIndex, sharedItem;
for (i = 0; i < cleanRanges.length; ++i) {
cleanRanges[i].cleanAll();
}
......@@ -4933,6 +4933,7 @@
var pivotFields = pivotTable.asc_getPivotFields();
var pageFields = pivotTable.asc_getPageFields();
var rowFields = pivotTable.asc_getRowFields();
var rowFieldsPos = [];
for (i = 0; i < pivotTable.pageFieldsPositions.length; ++i) {
pos = pivotTable.pageFieldsPositions[i];
cells = this.getRange4(pos.row, pos.col);
......@@ -4943,7 +4944,6 @@
cells = this.getRange4(pos.row, pos.col + 1);
cells.setValue('(All)');
}
var countC = pivotTable.getColumnFieldsCount();
var countR = pivotTable.getRowFieldsCount(true);
var c1 = pivotRange.c1;
......@@ -4951,6 +4951,15 @@
cells = this.getRange4(start, c1);
cells.setValue('Row Labels');
++start;
for (i = 0; i < rowFields.length; ++i) {
rowFieldsPos[i] = c1;
field = pivotFields[rowFields[i].asc_getIndex()];
if (field && false === field.compact) {
++c1;
}
}
var rowItem, rowItems = pivotTable.getRowItems();
if (rowItems) {
for (i = 0; i < rowItems.length; ++i) {
......@@ -4964,7 +4973,7 @@
sharedItem = cacheFields[indexField].getSharedItem(cacheIndex.x);
v = sharedItem.v;
}
cells = this.getRange4(start + i, c1 + j);
cells = this.getRange4(start + i, rowFieldsPos[rowItem.getR()]);
cells.setValue(v);
}
}
......
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