Skip to content

Commit deafbfc

Browse files
DataGrid - The pageIndex method should return a promise if dataSource is null (T1256070) (#28279)
1 parent 6d5e129 commit deafbfc

File tree

2 files changed

+17
-0
lines changed

2 files changed

+17
-0
lines changed

packages/devextreme/js/__internal/grids/grid_core/data_controller/m_data_controller.ts

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -57,6 +57,10 @@ const changePaging = function (that, optionName, value) {
5757
return dataSource[optionName]();
5858
}
5959

60+
if (optionName === 'pageIndex' && value !== undefined) {
61+
return Deferred().resolve().promise();
62+
}
63+
6064
return 0;
6165
};
6266

packages/devextreme/testing/testcafe/tests/dataGrid/pager.ts

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -238,3 +238,16 @@ test('Page index should not reset when scrolling while the grid is being refresh
238238
},
239239
height: 440,
240240
}));
241+
242+
test('No error should occur if dataSource is not defined and pageIndex is promise chained (T1256070)', async (t) => {
243+
const dataGrid = new DataGrid('#container');
244+
245+
// assert
246+
await t
247+
.expect(dataGrid.isReady())
248+
.ok();
249+
}).before(() => createWidget('dxDataGrid', {
250+
onContentReady(e) {
251+
e.component.pageIndex(1).then(() => {}, () => {});
252+
},
253+
}));

0 commit comments

Comments
 (0)