How to customize the filter of the entityPicker which trigered by DataGride list_add action

how to set query parameters of the entityPicker and hide the genericFilter, which trigered by the DataGrade list_add action.

list_add sction

list_add

Action class: AddAction

Adds existing entity instances to a data container by looking them up in a list view. Can be used to fill a many-to-many collection.

The easist way will be to create a new view that you will use for lookup by the list_add action and specify this view id in the view XML descriptor:

<action id="add" type="list_add">
     <properties>
          <property name="viewId" value="Employee.lookup"/>
     </properties>
</action>

thanks, I need set the list view query condition dynamically before it shows up when the ADD button clicked, how to do this?

微信截图_20230831120836

The first idea is to implement your own handler for the Add action execution. This handler will open the dialog and set some data into the lookup view. Having this data in lookup view you’ll be able to set any values you need.

Something like this:

    @Autowired
    private DialogWindows dialogWindows;

    @ViewComponent
    private DataGrid<Employee> employeesDataGrid;

    @Subscribe("employeesDataGrid.add")
    public void onEmployeesDataGridAdd(final ActionPerformedEvent event) {
        DialogWindow<EmployeeLookupView> dialogWindow = dialogWindows.lookup(employeesDataGrid)
                .withViewClass(EmployeeLookupView.class)
                .build();
        EmployeeLookupView view = dialogWindow.getView();
        view.setSomeData("123");
        dialogWindow.open();
    }

can get a api from list view to set the query condition:

微信截图_20230901074749

finally it works after expose a setParameter() by my self in list view. thanks gorbunkov.