Persistent filter

Hi,
I have this use case:

  • the user fills a filter (propertyFilter) with many fields, finds some results and edit the first one. When he goes back to entity list the filter has reset and lost the content of the fields.

How can I persists the fields user has put in the filter?
I am trying with propertyFilter, now also with genericFilter, that has a save button but it is not the right user experience (user must remember to name and save each filter).
Which is the best way to implement an automatic saving of filter contents?
Thanks,
Mario

Hi, Mario!

Have you used the urlQueryParameters facet mechanism? It allows you to save the propertyFilter state in the URL:
https://docs.jmix.io/jmix/flow-ui/facets/urlQueryParameters.html#components

   <facets>
        <urlQueryParameters>
            <genericFilter component="genericFilter"/>
        </urlQueryParameters>
    </facets>
    <layout>
        <genericFilter id="genericFilter"
                       dataLoader="usersDl">
            <properties include=".*"/>
        </genericFilter> 
    </layout>

Regards,
Dmitriy

Good idea I will try it!

Another idea I am trying is to use a dialog window.
I am using this code:

 DialogWindow<RicocoDetailView> window =
                dialogWindows.detail(this, Ricoco.class)
                        .withViewClass(RicocoDetailView.class)
                        .editEntity(ricocoesTable.getSingleSelectedItem())
                        .build();
        window.getView().setAzioneRichiesta(Azioni.LEGGI);
        window.open();

That works for edit mode. But now I need to implement “read” button so the dialog windows must start in read only mode. How can I do it?

If you want to just do this, you can use io.jmix.flowui.view.ReadOnlyViewsSupport class API.

However, correct configuration of security roles automatically makes the entity detail read-only for read-only entities.