SimplePagination setItemsPerPage from DB

Hello,
we want to load integers for pagination.setItemsPerPageItems from database and let admin decide pagination.setItemsPerPageDefaultValue via appSettings.

I’ve tried (in Jmix Base Project - UserListView):

<simplePagination id="pagination" dataLoader="usersDl" itemsPerPageVisible="true"/>

And in controller:

    @ViewComponent
    private SimplePagination pagination;

    @Subscribe
    public void onInit(final InitEvent event)
    {
        pagination.setItemsPerPageItems(List.of(100, 200, 300));
        pagination.setItemsPerPageDefaultValue(200);
    }

And I still have the default settings from Jmix (20, 50, 100, …) with default 50.

Jmix Version 2.6.2

Any help would be appreciated!
Best regards,
Stefanie

Hi, @stefanie.glatzer

I have been created the GitHub issue.

Try the following workaround in the BeforeShowEvent handler:

    @Subscribe
    public void onBeforeShow(final BeforeShowEvent event) {
        pagination.setItemsPerPageDefaultValue(200);
        pagination.setItemsPerPageItems(List.of(100, 200, 300));
        pagination.setPaginationLoader(pagination.getPaginationLoader()); //triggers repainting rows per page component
    }

Regards,
Maria.

Hi Maria,
with this workaround the DefaultValue 200 is read only and user may not choose anymore from 100, 200, 300.
Best regards,
Stefanie

@stefanie.glatzer Did you place this workaround in the BeforeShowEvent handler instead of InitEvent event handler?

Hi Maria,
yes, it is in onBeforeShow.
In a demo project it works fine with the dropdown, in my project the dropdown is read only :neutral_face:
I guess I keep searching…
Thanks for your help and for creating the GitHub issue.
Best regards,
Stefanie