View Full Version : Composite removal from container

6 May 2008, 8:31 AM
I used to be able to add/remove Composites from WidgetContainer. Now in beta-2 the Container allows add(Composite), but we do not have remove(Composite) anymore. I have to wrap all Composite in a Container.

removeFromParent() does not work.

Any thought/idea?

6 May 2008, 1:03 PM
In GXT we have Container which replaces WidgetContainer - this class has an add() and remove() - and removeAll()

I think this should be what you need.

6 May 2008, 1:08 PM
nah sorry - misunderstood what you mean... you are asking about GWT Container, so I guess this might be a bug... a change was made to auto-wrap GWT widgets into Components so that they can be auto-added.

Calling remove obviously doesn't expose the same objects to be removed.

You could check the source code for add(widget) work out what it does to wrap it and then do the wrap yourself, that way you'd know what was added and be able to remove that component...

I hope this is clear?

7 May 2008, 3:44 AM
I'm talking about com.extjs.gxt.ui.client.widget.Container.

add(Composite) works, but there is only remove(Component).

So what I have to do right now, is exactly what you are saying... Meaning keep track on a container around my composite. It works, but it is cumbersome.

Well, actually since the method signatures is actually add(Widget), then we should also have remove(Widget) and not remove(Component). :))

7 May 2008, 7:36 AM
Remove now accepts a widget and there is a new findComponent(Widget widget) that returns the wrapped component for a given widget. Changes will go in beta 3.

7 May 2008, 7:46 AM
Thanks! =D>