Magento 2 Admin Grid Pagination Issue

Recently I ran into an issue with an admin grid pagination for a custom grid I had built. When I access the page with the grid, it displays it properly. It displays the first 20 items in that array. If I click the “Next” button in the pagination, that also works properly, it shows the next items. The problem arises when I click the “Back” button. The UI grid seems to have some sort of caching system, it doesn’t make another ajax request when it has to show results that you’ve already seen before.. So, when I click “back” it just shows me the last item in the array for that page 20 times. The same thing happens if I switch the pagination from “20” per page to “30” per page, then switch it back to “20”.

The issue was fixed by changing the ui_component xml so the field names are correct. Using the example from the stackexchange.com post. Make sure the “primaryFieldName”, “requestFieldName”, “indexField” are correct. If they are not correct you could see the issue I was having.

stackexchange.com Post: https://magento.stackexchange.com/questions/209682/magento-2-ui-grid-non-db-dataprovider-and-pagination-issue

Leave a Reply

Your email address will not be published. Required fields are marked *