When dynamically adding new layout component to a Vaadin ApplicationPortlet2; this allways causes the browser to scroll to the top.
The same does not happen, when we execute the application outside of the portal or if we use the ApplicationPortlet (instead of ApplicationPortlet2)
To reproduce this we can use this simple code:
public class MyVaadinApplication extends Application {
private Window window;
@Override
public void init() {
window = new Window("My Vaadin Application");
setMainWindow(window);
Button button = new Button("Add button");
button.setImmediate(true);
button.addListener(new Button.ClickListener() {
public void buttonClick(ClickEvent event) {
// The following code caused the browser to scroll up when using
// ApplicationPortle2 on Liferay
HorizontalLayout layout = new HorizontalLayout();
Button msg = new Button("MyButton");
msg.setImmediate(true);
layout.setSizeFull();
layout.addComponent(msg);
Window main = event.getComponent().getApplication().getMainWindow();
main.addComponent(layout);
}
});
window.addComponent(button);
}
}
When we click the “Add button”, and having browsers scroll not set to top, it will scroll up
This does not happen if we use ApplicationPortlet, or run it outside of the portal (as a Vaadin Application)
Need some help to try to figure out this different behaviour
Attaching a vaadin application that can be used to reproduce this.
=======================
Versions Used
Vaadin Version: 6.6.8
Portlet Container: Liferay 6.0.6
Application Server: GlassFish 3.1.2
regards,
Bruno Antunes
12315.zip (7.04 KB)