Lost handlers after moving Element of a Widget

4 views
Skip to first unread message

Flori

unread,
Dec 28, 2010, 5:54:11 AM12/28/10
to Google Web Toolkit
Hey all,

I've got some code which moves some elements from one to another
position:
>CustomPicker picker = new CustomPicker(textBox); //FlowPanel with custom elements inside...
>Element inputElement = textBox.getElement();
>Element parentElement = inputElement.getParentElement();
>parentElement.insertAfter(picker.getElement(), inputElement);
>picker.pickerWrapper.getElement().insertFirst(inputElement);

This code works fine together with the DOM, but my picker contains an
HTMLPanel which has an ClickHandler. If I attach the picker to the DOM
using RootPanel.get().add(picker); the ClickHandler seems to works
fine. If I use the way described above the handler doesn't seemss to
work anymore :( Any ideas/hints?

Thanks in advance! cheers

Flori

unread,
Dec 28, 2010, 8:21:39 AM12/28/10
to Google Web Toolkit
Okay.. I've to call onAttach manually after I added the picker element
to the DOM to get my custom handlers working:

picker.onAttach();
RootPanel.detachOnWindowClose(picker);

I don't know really why.. but it's working fine for me.
Reply all
Reply to author
Forward
0 new messages