Reputation: 7426
I'm trying to print a GWT widget as follows,
String html = DOM.getElementById("id").getInnerHTML();
Print.it(html);
I'm not getting the entire html content of the widget. So i'm not able to print the expected result.
Can you help me? Or tell me the alternative way of printing a particular GWT widget from the view.
Thanks in advance, Gnik
Upvotes: 0
Views: 816
Reputation: 1022
Well, it should print the HTML code. Calling DOM statically may generate 2 problems for you:
You can try to retrieve the HTML code with this widget.asWidget().getElement().getInnerHTML();
That should give you the correct HTML representation of the widget.
And make sure you are calling those methods after the elements are loaded (onLoad()
) into the document, or you may recieve a JavaScriptException
due to the element being null (check here for more info).
Upvotes: 3