V2.1 - open view and pass parameters

Hi,

I read the doc how to open views and pass a parameter (window.getView.setsomething()…)

I have a blank view called ObjectLinesView and I want to pass a parameter into it when I open it as a modal window using the build() method.
– DialogWindow window = dialogWindows.view(this, ObjectLinesView.class).build();
In the controller of the view I defined a public String myText .
How to pass a parameter into that variable myText.
(In v 1.x I use the ScreenOptions…)

In the opener I cannot see the the.setMyText like
window.getView.setMyText() …
I can only see
window.getView.myText

Is there any example further than I can find in the docs?
Or does it not work with a blank view?

KR
Roland

I found one way how to do it… but looks different then in the docs

I added a
textField id=“inputField”
in the descriptor
Injected it in the controller
@ViewComponent
public TypedTextField inputField;

And the opener script I could use:
window.getView().inputField.setValue("");

Hi Roland,

DialogWindow<MyOnboardingView> window =
            dialogWindows.view(this, MyOnboardingView.class).build();
window.getView().setUsername(username);
window.open();

This code from the docs assumes that MyOnboardingView class has the setUsername() public method. It’s the responsibility of the developer to create such a method if needed.

Regards,
Konstantin

1 Like