> Ah, I see what you mean. Sorry for not reading the issue report more
> carefully the first time around.
No problem, thanks for increasing the priority and for testing the
issue across browsers.
> For the moment, simply cloning the original widget and using that clone
> seems to be the best workaround.
I've tried this, but can't get it to work right. First, I don't know
how to make this work in general, because Widget doesn't have a clone
() method. Second, for the various subclasses of Widget that I've
tried, so far all of them lose their "content" when they are removed
from the tree - so I can't just keep a reference.
The only general approach I can think of is to wrap every node in a
panel from the start, so that I can add/remove from that panel as
needed. I'm pretty sure I tried something along these lines a year ago
and found it to be problematic (too "heavy", as I recall).
In my existing code, most of my TreeItem content is HTML, so it should
be possible for me to "clone/copy" just the content as a String,
squirrel it away and, after editing, return the node to its normal
state by inserting a newly instantiated HTML object. I'll try this and
see if I can get it to work - but it precludes me from using anything
other than text or HTML in each node.
> You could also try appending the button the
> way you've been doing before, but it'll take some tinkering around to get it
> hooked up properly and have the click event reach the handler.
I've done a lot of tinkering already, without success. My tree has a
SelectionHandler, and that seems to keep the ClickHandler from
executing when the Button's Element is appended to the DOM directly. I
read the memory leak / cycle / event listener article, and I tried
adding a call to sinkEvent(Event.ONCLICK), but it didn't work. I'm
basically poking around in the dark ... if you can think of a
workaround, I'd like to try it. I think the relevant conditions are: a
Tree with SelectionHandler, OpenHandler, CloseHandler and onSelection
() should dynamically append a Button with a ClickHandler next to the
TreeItem content (similarly, onSelection() should first remove this
Button from any previously selected nodes).
> If keeping
> clones around proves to be a problem (for example, having to do this for
> more than a couple of widgets), let me know and we can dig in deeper on the
> manual DOM.appendChild() workaround until Issue #2297 gets a fix.
>
> Hope that helps,
> -Sumit Chandel
Thanks, you've definitely been a great help.
> > > - Show quoted text -- Hide quoted text -