Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -164,7 +164,7 @@ class PivotGridHelpers {
}

const fields = this._getAllFieldHeaders()[area === 'data' ? 'values' : `${area}s`]
.filter((fieldHeader) => fieldHeader.area === area);
.filter((fieldHeader) => fieldHeader.area === area && fieldHeader.visible !== false);

if (getDefaultAlignment(this.rtlEnabled) === 'right') {
fields.sort((a, b) => b.areaIndex - a.areaIndex);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7829,6 +7829,38 @@ QUnit.module('Scenarios', moduleConfig, () => {
done();
});
});

// T1325416 - Fields with visible:false should not be exported in field headers
QUnit.test('Data fields with visible:false should not be exported in data field headers', function(assert) {
const done = assert.async();
const ds = {
fields: [
{ area: 'row', dataField: 'row' },
{ area: 'data', dataField: 'Sales', summaryType: 'sum', caption: 'Sales', visible: true },
{ area: 'data', dataField: 'Sales2', summaryType: 'sum', caption: 'Sales2', visible: false },
{ area: 'data', dataField: 'Sales3', summaryType: 'sum', caption: 'Sales3', visible: false }
],
store: []
};
const pivotGrid = $('#pivotGrid').dxPivotGrid({ dataSource: ds }).dxPivotGrid('instance');

exportPivotGrid({
component: pivotGrid,
worksheet: this.worksheet,
topLeftCell: topLeft,
exportDataFieldHeaders: true
}).then(() => {
const dataFieldHeaderCell = this.worksheet.getRow(topLeft.row).getCell(topLeft.column);
const cellValue = dataFieldHeaderCell.value;

assert.strictEqual(cellValue, 'Sales', `Data field header should show 'Sales', got: '${cellValue}'`);

assert.ok(!cellValue.includes('Sales2'), 'Data field header should not contain Sales2');
assert.ok(!cellValue.includes('Sales3'), 'Data field header should not contain Sales3');
done();
});
});

});
});

Expand Down Expand Up @@ -8074,7 +8106,6 @@ ExcelJSLocalizationFormatTests.runPivotGridCurrencyTests([
]);
ExcelJSOptionTests.runTests(moduleConfig, exportPivotGrid.__internals._getFullOptions, () => $('#pivotGrid').dxPivotGrid({}).dxPivotGrid('instance'));


[
{ enabled: true },
{ enabled: false },
Expand Down
Loading