On Mar 17, 12:04 am, Stefan Ballmer <[email protected]> wrote: > Is it possible to add a widget to a DOM element? > > I have some DOM structure that I need to directly create in code and > I'd like to add a GWT widget as a child element of this DOM structure. > > Currently I'm using something like the following code to add a > SuggestBox: > > domElement.appendChild(getSuggestBox().getElement()); > > While this code adds the underlying text input field to the DOM tree, > the suggestion feature of the suggest box does not work. However, when > I add the Widget directly as child element of another widget > everything works fine. > > Does the call to getElement() somehow "partition" the Widget from the > DOM element so that the DOM element is added without the Widget > functionality? How can I add a Widget as child of a DOM element?
Have a look at the javadoc for the "attach" and "detach" related methods in the Widget class; and then look at the code for, e.g. HTMLPanel, HTMLTable, CellPanel, etc. -- You received this message because you are subscribed to the Google Groups "Google Web Toolkit" group. To post to this group, send email to [email protected]. To unsubscribe from this group, send email to [email protected]. For more options, visit this group at http://groups.google.com/group/google-web-toolkit?hl=en.
