IllegalStateException: CreateAction target is not set

Hello,

Clicking the button takes an action, but it returns this error. Below is the screenshot and code.
Version: Jmix 1.5 flowui
Screenshot 2023-03-24 at 20.15.33

    @Subscribe
    public void onInit(InitEvent event) {
        CreateAction<User> registerPerson = new CreateAction<>();
        registerPerson.setOpenMode(OpenMode.NAVIGATION);
        registerPerson.setViewClass(SignupDetailsView.class);
        registerPerson.setText(messageBundle.getMessage("continue"));
        selectPersonTypeButton.setAction(registerPerson);
    }

Hello!

CreateAction is an action that supposed to be used in DataGrid (or in general in components based on ListDataComponent interface). It requires to know to which component action is assigned. So you see an error if “target” (DataGrid) is not set.

If you want to open the “detail” View to create a new instance of some entity, use ViewNavigators :

@Autowired
ViewNavigators viewNavigators;

viewNavigators.detailView(MyEntity.class)
        .newEntity()
        .withViewClass(MyEntityDetailsView.class)
        .navigate();
1 Like

Thank you for your solution.