Skip to content

Commit f4a744f

Browse files
committed
refix
1 parent 29f7c02 commit f4a744f

2 files changed

Lines changed: 20 additions & 19 deletions

File tree

packages/devextreme/js/__internal/grids/grid_core/pager/m_pager.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -9,9 +9,9 @@ const PAGER_CLASS = 'pager';
99
export const MAX_PAGES_COUNT = 10;
1010

1111
const getPageIndex = function (dataController) {
12-
if (dataController.pageSize() === 0) {
13-
return dataController.pageCount();
14-
}
12+
// if (dataController.pageSize() === 0) {
13+
// return dataController.pageCount();
14+
// }
1515

1616
// eslint-disable-next-line radix
1717
return 1 + (parseInt(dataController.pageIndex()) || 0);

packages/devextreme/js/__internal/grids/grid_core/virtual_scrolling/m_virtual_scrolling.ts

Lines changed: 17 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -1026,18 +1026,17 @@ export const data = (Base: ModuleType<DataController>) => class VirtualScrolling
10261026
}
10271027

10281028
private _getChangedLoadParams() {
1029-
const loadedPageParams = this.getLoadPageParams(true);
1030-
const { pageIndex, loadPageCount } = this.getLoadPageParams();
1031-
const pageIndexIsValid = this._pageIndexIsValid(pageIndex);
1032-
let result: any = null;
1033-
1034-
if (!this._isLoading && pageIndexIsValid && (pageIndex !== loadedPageParams.pageIndex || loadPageCount !== loadedPageParams.loadPageCount)) {
1035-
result = {
1036-
pageIndex,
1037-
loadPageCount,
1038-
};
1029+
const lastLoadPageParams = this.getLoadPageParams(true);
1030+
const loadPageParams = this.getLoadPageParams();
1031+
const pageIndexIsValid = this._pageIndexIsValid(loadPageParams.pageIndex);
1032+
const isParamsChanged = loadPageParams.pageIndex !== lastLoadPageParams.pageIndex
1033+
|| loadPageParams.loadPageCount !== lastLoadPageParams.loadPageCount;
1034+
1035+
if (!this._isLoading && pageIndexIsValid && isParamsChanged) {
1036+
return loadPageParams;
10391037
}
1040-
return result;
1038+
1039+
return null;
10411040
}
10421041

10431042
private _pageIndexIsValid(pageIndex) {
@@ -1061,18 +1060,16 @@ export const data = (Base: ModuleType<DataController>) => class VirtualScrolling
10611060
const allLoadedInAppendMode = isAppendMode(this) && this.totalItemsCount() < lastRequiredItemCount;
10621061
const isRepaintMode = this.option('editing.refreshMode') === 'repaint';
10631062
const pageIndexIncreased = changedParams?.pageIndex > currentPageIndex;
1064-
let result = false;
10651063

10661064
if (!dataSourceAdapter || (virtualPaging && checkLoading && ((isRepaintMode && viewportIsFilled) || (pageIndexIncreased || pageIndexNotChanged && allLoadedInAppendMode)))) {
1067-
return result;
1065+
return false;
10681066
}
10691067

10701068
if (virtualPaging && this._isLoading) {
10711069
this._needUpdateViewportAfterLoading = true;
10721070
}
10731071

10741072
if (virtualPaging && changedParams) {
1075-
result = true;
10761073
dataSourceAdapter.pageIndex(changedParams.pageIndex);
10771074
dataSourceAdapter.loadPageCount(changedParams.loadPageCount);
10781075
this._repaintChangesOnly = true;
@@ -1083,15 +1080,17 @@ export const data = (Base: ModuleType<DataController>) => class VirtualScrolling
10831080
this._needUpdateDimensions = undefined;
10841081
}).done(() => {
10851082
const isLastPage = this.pageCount() > 0 && this.pageIndex() === this.pageCount() - 1;
1086-
(viewportChanging || isLastPage) && this._updateVisiblePageIndex();
1083+
// (viewportChanging || isLastPage) && this._updateVisiblePageIndex();
10871084
if (this._needUpdateViewportAfterLoading) {
10881085
this._needUpdateViewportAfterLoading = false;
10891086
this.loadViewport({ checkLoadedParamsOnly: true });
10901087
}
10911088
});
1089+
1090+
return true;
10921091
}
10931092

1094-
return result;
1093+
return false;
10951094
}
10961095

10971096
private loadViewport(params?) {
@@ -1116,6 +1115,8 @@ export const data = (Base: ModuleType<DataController>) => class VirtualScrolling
11161115
useProcessedItemsCache: noPendingChangesInEditing,
11171116
cancelEmptyChanges: true,
11181117
});
1118+
1119+
this._updateVisiblePageIndex();
11191120
}
11201121
}
11211122
}

0 commit comments

Comments
 (0)