How can we use urlqueryparameters in oninit event

I am using jmix 2.1

I am implementing tree vaadin addon but i want it to load data filtered by supplied url query parameters. How i can use urlqueryparameters in oninit event or otherway?

Thanks

1 Like

Hello!

Take a look at the documentation section about opening views: Opening Views :: Jmix Documentation.

There is an example of handling QueryParametersChangeEvent:

@ViewComponent
private H1 messageLabel;

public void setMessage(String message) {
    messageLabel.setText(message);
}

@Subscribe
public void onQueryParametersChange(final QueryParametersChangeEvent event) {
    List<String> messageParams = event.getQueryParameters().getParameters().get("message");
    if (messageParams != null && !messageParams.isEmpty())
        setMessage(messageParams.get(0));
}