executeJavaScript on subWindow, doesn't work for me


public class MyApplication extends Application {
public void init() {

	Window mainWindow = new Window("test");
	Label label = new Label("Main window!!!");
	Window another = new Window("another");		
	another.executeJavaScript("alert('Hello world')");
	another.addComponent(new Label("I am another window"));				


Going to the main page is fine, I see the label, I see the alert dialog come up. If I then go to /another I see the new window with its label, but no alert dialog. What am I doing wrong? (I’m a super newbie at Vaadin).


executeJavaScript() only works on browser windows, not subwindows. Unfortunately, the API documentation does not seem to state that.

In general, the class Window is used both for browser windows and for subwindows in Vaadin 6, and some API is only relevant for one or the other of the cases. Vaadin 7 will split these roles so the class Window will only correspond to subwindows, giving a much cleaner API.

Ah, found that code was only getting executed on app start, so I had to ask for /another?restartApplication

Then I got to see the “Hello world” alert window.

As I said, very new to Vaadin, don’t know component lifecycle, going through “Learning Vaadin” book.