I have got the main class (say StockWatcher
) call a JSNI to define a jQuery UI dialog within the body at page-load. The dialog is called within a JSNI
function. On onModuleLoad
, I do something like prepareUI();
. The prepareUI
JSNI runs as follows:
public void native prepareUI() /*-{
$wnd.jQuery($doc).ready(function($) {
message = "<div id = 'message'>Don't do this...</div>
$(message).appendTo("body");
$( "#message" ).dialog({
modal: true,
buttons: {
Ok: function() {
$( this ).dialog( "close" );
}
},
close:function() { this.@com.google.gwt.sample.stockwatcher.client.StockWatcher::doit()(); },
autoOpen: true,
show: {
effect: "puff",
duration: 500
},
hide: {
effect: "explode",
duration: 500
}
});
});
}-*/;
This is followed by the doit()
function, which is simple enough:
public void doit() {
Window.alert("Foo");
}
But, on page-load, even though the dialog appears correctly, and even closes corrrectly on clicking the Ok
button, the alert doesn't pop up (No error is shown in console). Can anyone tell me how to fix this? The class within which this is done is StockWatcher
in the package com.google.gwt.sample.stockwatcher.client
(imagine the default GWT StockWatcher
package hierarchy).