how to pass hash map to native java script method
I am trying to pass a Hashmap to a native method as can be seen below.
I have been unable to find any suitable example code. Any assistance
would be greatly appreciated.
I know this is simple, I just haven't done it before.
Thanks.
public void onClick(ClickEvent event)
{
Map<String, String> params = new HashMap<String, String>();
params.putAll(definition.getParams());
.... this is where my problem is, how to convert the params
object to a suitable
object to work with the native openReportWindow method
openReportWindow(definition.getReportServletName(), params);
}
private static native void openReportWindow(String action, values) /*-
{
var form = document.createElement("form");
form.setAttribute("method", "post");
form.setAttribute("action", action);
// setting form target to a window named
'formresult'
form.setAttribute("target", "_blank");
for (var i=0; i<values.length; i++) {
var hiddenField = document.createElement("input");
hiddenField.setAttribute("name", values[i].name);
hiddenField.setAttribute("value", values[i].value);
form.appendChild(hiddenField);
}
document.body.appendChild(form);
form.submit();
document.body.removeChild("form");
}-*/;
--
You received this message because you are subscribed to the Google Groups "Google Web Toolkit" group.
To post to this group, send email to google-web-toolkit@googlegroups.com.
To unsubscribe from this group, send email to google-web-toolkit+unsubscribe@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/google-web-toolkit?hl=en.
0 Comments:
Post a Comment
Subscribe to Post Comments [Atom]
<< Home