Parameter in entity lookup

hey guys,

using Jmix 2.0 + FlowUi + Java

many changes are still unclear, but I understand the process.

if you can help me how to call an Action “entity_lookup” passing parameters to the class to be used.

to make understanding easier, depending on the location where the call is made, some filter is passed, for example

customer, seller, supplier… but the screen is the same, that is, the information is in the same table, but a tag differentiates the record

in Jmix 1.5 used as follows

@Install(to = “vendedorField.entityLookup”, subject = “screenConfigurer”)
private void vendedorFieldEntityLookupScreenConfigurer(TabPessoaBrowse screen) {
screen.setOrigem(“vendedorPedido”);
}

and the screen that opens has the handle for that property, and the magic happens.

In this case, what would be the correct way to proceed?

1 Like

Hi,

You’re right, currently there is no similar API to screenConfigurer. I’ve created a GitHub issue.

As for now, you can do the same using the following snippet:

@ViewComponent
private EntityPicker<User> assigneeField;

@Autowired
private DialogWindows dialogWindows;

@Subscribe("assigneeField.entityLookup")
public void onAssigneeFieldEntityLookup(final ActionPerformedEvent event) {
    DialogWindow<UserListView> builder = dialogWindows.lookup(assigneeField)
            .withViewClass(UserListView.class)
            .build();

    builder.getView().setFoo("bar");
    builder.open();
}

Regards,
Gleb

2 Likes

your guidance works,

the only setback, that the screen does not go into selection mode, and stays in list mode as if it were through the menu,

some code on the screen to handle the situation and it works.

Thanks a lot for the tip, I’ll monitor the fix to apply when it’s released.