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