Thursday, May 30, 2013

Re: Dynamically generated HTML and GWT

Hi,

The HTMLPanel accepts HTML snippets, you should not put and entire HTML page in it since it is part of the window document.
So what you are doing is correct. Otherwise you will have to play with Frames (which you should avoid due to memory leak issues).

For the second question: the HTMLPanel has some methods that allow you to wrap a widget on existing DOM elements. So in your case, you could wrap the submit button. You just need to find the correct element in the generated DOM tree (using an ID would be the easiest).

To find the element by id you can use: 

To "wrap" the element you use the wrap method on SubmitButton:

One final note: You should use a deferred call before trying to find the submit button element because the setInnerHTML does not take effect immediately.

David

On Thu, May 30, 2013 at 6:58 AM, Mike Dee <mdichiappari@gmail.com> wrote:
Hi,

I'm hoping this can be done with relative ease in GWT.  I need to integrate a couple of features that involve HTML that is generated on the fly. Basically, the app gets some XML and sends it to a service which returns HTML (via an XSL transform).

There are two cases. 

1) The first is easy and it is working with GWT, but I have a question.  We just create an HtmlPanel and put the HTML in it.  But does the HTML need to be complete - should it have HTML, HEAD, and BODY tags or can it just be a blob of HTML?  Right now it does not have the HTML header and it works (the blob is wrapped in a DIV).  Just want to know what is "correct".

2) The second case is a little more tricky. It is similar to the first, but the HTML is a form.  So, it needs to display (which it does).  But how do I handle the submit button?

Thanks,
Mike

--
You received this message because you are subscribed to the Google Groups "Google Web Toolkit" group.
To unsubscribe from this group and stop receiving emails from it, send an email to google-web-toolkit+unsubscribe@googlegroups.com.
To post to this group, send email to google-web-toolkit@googlegroups.com.
Visit this group at http://groups.google.com/group/google-web-toolkit?hl=en.
For more options, visit https://groups.google.com/groups/opt_out.
 
 

--
You received this message because you are subscribed to the Google Groups "Google Web Toolkit" group.
To unsubscribe from this group and stop receiving emails from it, send an email to google-web-toolkit+unsubscribe@googlegroups.com.
To post to this group, send email to google-web-toolkit@googlegroups.com.
Visit this group at http://groups.google.com/group/google-web-toolkit?hl=en.
For more options, visit https://groups.google.com/groups/opt_out.
 
 

No comments:

Post a Comment