Search code examples
javavaadinvaadin-flowform-layout

Is there a way, to include a method into a responsive step on a form layout


Does anyone know a way to include a method into a responsive step, for example when (in the code below) the window is resized to the point where the formlayout is less than the specified value at 1010px, the layout changes itself to 1 column like in the first responsive step, but what i also want during this switch between responsivesteps, is a couple lines of my own code, like a custom method i could include and write whatever i want in it, that triggers when the formlayout width is below 1010px.

formLayout.setResponsiveSteps(
                new FormLayout.ResponsiveStep("0", 1, FormLayout.ResponsiveStep.LabelsPosition.TOP),
                new FormLayout.ResponsiveStep("1010px", 2));

Edit : Vaadin 13.0.4 flow is what im using


Solution

  • No, there is not. But there is a more generic BrowserWindowResizeEvent, which you can listen to by adding listener via Page class using addBrowserWindowResizeListener(BrowserWindowResizeListener resizeListener), and achieve probably the thing you are looking for.