Reputation: 881
I am trying to add jquery in Vaadin 6.x, but vaadin is executing js before loading page, so jquery tags are not recognized and does not load on page.
I am executing jquery function like following
public void attach()
getApplication().getMainWindow().executeJavaScript("alert('attached');$('a.media').media();");
but alert statement and jquery function executes before loading page, so jquery component fails to load.
If I execute this script in setTimeout()
of javascript with delay of 2-3 seconds then jquery works fine.
Does anyone know how to get event in vaadin which tells exactly at what time vaadin load page?
Upvotes: 0
Views: 1468
Reputation: 1211
With jQuery, you can use this:
$(function() {
// Insert your code here
});
This use the .ready()
function. It will be executed when the document has been totaly loaded.
Upvotes: 1