diff --git a/src/main/java/gwt/material/design/client/ui/pager/MaterialDataPager.java b/src/main/java/gwt/material/design/client/ui/pager/MaterialDataPager.java index df9eb0a5..d5fa786e 100644 --- a/src/main/java/gwt/material/design/client/ui/pager/MaterialDataPager.java +++ b/src/main/java/gwt/material/design/client/ui/pager/MaterialDataPager.java @@ -165,18 +165,20 @@ public boolean isLastPage() { protected void doLoad(int offset, int limit) { this.offset = offset; - // Check whether the pager has excess rows with given limit - if (isLastPage() & isExcess()) { - // Get the difference between total rows and excess rows - limit = totalRows - offset; - } - - int finalLimit = limit; dataSource.load(new LoadConfig<>(offset, limit, table.getView().getSortContext(), table.getView().getOpenCategories()), new LoadCallback() { @Override public void onSuccess(LoadResult loadResult) { totalRows = loadResult.getTotalLength(); + + int finalLimit = limit; + + // Check whether the pager has excess rows with given limit + if (isLastPage() & isExcess()) { + // Get the difference between total rows and excess rows + finalLimit = totalRows - offset; + } + table.setVisibleRange(offset, finalLimit); table.loaded(loadResult.getOffset(), loadResult.getData()); updateUi();