1

I have a problem with pagination in UI Component data grid of Magento2. enter image description here First time it loads page correctly and pagination works. But on clicking "back" button in paginator all rows change their original content and become copies of the same one row! Pagination direction does not matter, FIRST TIME it paginates correctly in both directions. The problem is only when visiting paginated data AGAIN.

Here is a link to code sample on GitHub: https://github.com/mageplaza/magento-2-sample-module

2

Open mageplaza_helloworld_post_listing.xml at

view/adminhtml/ui_component/mageplaza_helloworld_post_listing.xml

Now replace <item name="update_url" xsi:type="url" path="mui/index/render"/> </item> at line number 42 as per your code

Replace

<argument name="data" xsi:type="array">
    <item name="config" xsi:type="array">
        <item name="update_url" xsi:type="url" path="mui/index/render"/>
    </item>
</argument>

To

<argument name="data" xsi:type="array">
    <item name="config" xsi:type="array">
        <item name="component" xsi:type="string">Magento_Ui/js/grid/provider</item>
        <item name="update_url" path="mui/index/render" xsi:type="url"/>
        <item name="storageConfig" xsi:type="array">
            <item name="indexField" xsi:type="string">index_id</item>
        </item>
    </item>
</argument>

Note: Replace index_id to your index field (Main Primary Field)

Now flush the cache and try.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.