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 @@ -143,7 +143,7 @@ export class FieldChooser extends FieldChooserBase {

_dispose() {
this._disposeDataSource();
super._dispose.apply(this, arguments);
super._dispose();
}

_init() {
Expand Down
15 changes: 13 additions & 2 deletions packages/devextreme/js/__internal/grids/pivot_grid/m_widget.ts
Original file line number Diff line number Diff line change
Expand Up @@ -135,6 +135,8 @@ class PivotGrid extends Widget {

_fieldChooser: any;

_fieldChooserBase: any;

_columnsArea: any;

_rowsArea: any;
Expand Down Expand Up @@ -408,6 +410,9 @@ class PivotGrid extends Widget {
case 'allowSortingBySummary':
case 'scrolling':
case 'stateStoring':
if (that._fieldChooserBase) {
that._fieldChooserBase._dispose();
}
that._initDataController();
that.getFieldChooserPopup().hide();
that._renderFieldChooser();
Expand Down Expand Up @@ -1174,7 +1179,7 @@ class PivotGrid extends Widget {

that.$element().addClass(OVERFLOW_HIDDEN_CLASS);

that._createComponent(that.$element(), FieldChooserBase, {
that._fieldChooserBase = that._createComponent(that.$element(), FieldChooserBase, {
dataSource: that.getDataSource(),
encodeHtml: that.option('encodeHtml'),
allowFieldDragging: that.option('fieldPanel.allowFieldDragging'),
Expand Down Expand Up @@ -1266,10 +1271,16 @@ class PivotGrid extends Widget {
_dispose() {
const that = this;
clearTimeout(that._hideLoadingTimeoutID);
super._dispose();

if (that._fieldChooserBase) {
that._fieldChooserBase._dispose();
}

if (that._dataController) {
that._dataController.dispose();
}

super._dispose();
}

_tableElement() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1044,6 +1044,24 @@ QUnit.module('dxPivotGrid', {

});

QUnit.test('T1317109: fieldChooser disposes on dataSource change', function(assert) {
const pivotGrid = createPivotGrid({
dataSource: {
rows: [],
columns: [],
values: []
}
});

const disposeSpy = sinon.spy(pivotGrid._fieldChooserBase, '_dispose');

pivotGrid.option('dataSource', this.testOptions.dataSource);

this.clock.tick(500);

assert.ok(disposeSpy.calledOnce, '_dispose was called once on dataSource change');
});

QUnit.test('not show field chooser popup on description area click when fieldChooser disabled', function(assert) {
createPivotGrid({
fieldChooser: {
Expand Down
Loading