Skip to content

Commit bb967c1

Browse files
authored
(T1276443) fix selection row restoration after gantt is refreshed (DevExpress#28999)
1 parent 3c6f2f4 commit bb967c1

File tree

2 files changed

+23
-1
lines changed

2 files changed

+23
-1
lines changed

packages/devextreme/js/ui/gantt/ui.gantt.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -113,7 +113,7 @@ class Gantt extends Widget {
113113
}
114114
_refreshGantt() {
115115
this._refreshDataSources();
116-
this._refresh();
116+
setTimeout(() => this._refresh());
117117
}
118118
_refreshDataSources() {
119119
this._refreshDataSource(GANTT_TASKS);

packages/devextreme/testing/tests/DevExpress.ui.widgets/ganttParts/refresh.tests.js

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -108,4 +108,26 @@ QUnit.module('Refresh', moduleConfig, () => {
108108
assert.ok(dataLoaded);
109109
assert.equal(this.instance.getTaskData(1).title, 'test');
110110
});
111+
test('check selected row index index after refresh', function(assert) {
112+
this.createInstance(options.allSourcesOptions);
113+
this.clock.tick(10);
114+
115+
assert.equal(this.instance.option('selectedRowKey'), undefined);
116+
117+
this.$element
118+
.find(Consts.TREELIST_DATA_ROW_SELECTOR)
119+
.eq(2)
120+
.trigger('dxclick');
121+
122+
this.clock.tick(10);
123+
124+
assert.notEqual(this.instance.option('selectedRowKey'), undefined);
125+
126+
const selectedRowKey = this.instance.option('selectedRowKey');
127+
128+
this.instance.refresh();
129+
this.clock.tick(10);
130+
131+
assert.equal(this.instance.option('selectedRowKey'), selectedRowKey);
132+
});
111133
});

0 commit comments

Comments
 (0)