Hi,
I'm trying to figure out onAttach() onDetatch() onDetachChildren() to
ensure I'm not leaking, but I don't quite get it. Is there a
reference somewhere? Am I best digging through the code to figure out
the flow? I've read the javadocs, but am having a hard time putting
it together.
Got a gwt app, server sends me down a block of html (a table which is
a calendar), gwt client takes the html, and calls setInnerHtml() on a
widget. Perfect.
The server's html has a <div id="foo"></div> that I want to take over,
and shove widgets into.
It'd be nice if I could do:
RootPanel().get("foo").add(...); // but this asserts
What I've done instead is create a wrapper which subclasses Widget,
implements HasClickHandlers, and makes onAttach() public.
Then I create my wrapped Anchor, get the div in the server's html and
append:
Anchor link = new Anchor("click me");
MyWrapper wrapper = new MyWrapper(link.getElement());
wrapper.addOnClickHandler(...);
wrapper.onAttach(); // without this, I can't handle the clicks
HorizontalPanel hp = new HorizontalPanel();
hp.add(link);
// add more to hp
DivElement serverElement =
Document.get().getElementById("foo").cast();
serverElement.appendChild(hp.getElement());
--- This all works great. I've got my panel in the div, and the link
works.
I'm just wondering if I need to do more, as I don't really 'get' the
attach, detach, detachChildren flow.
Thanks.
--
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.