PDA

View Full Version : I can't remove gxt grid component from ContentPanel



CHEM_Eugene
29 Feb 2012, 1:42 AM
Hello!

I have a view (in the mvp4g paradigm) which extends com.google.gwt.user.client.ui.Composite. In this view I made initWidget(grid). This view is added to ContentPanel component.
When I change views I do: contentPanel.removeAll() and contentPanel.add(newView).
It result in newView is added to ContentPanel, but grid isn't disappear. Moreother, grid becomes inactive. I can't select a row or resize header.

CHEM_Eugene
29 Feb 2012, 2:53 AM
Workaround was found:

If I wrap grid with com.google.gwt.user.client.ui.FlowPanel, the removing works fine!

WesleyMoy
1 Mar 2012, 4:00 PM
I can't seem to replicate this issue. ContentPanel doesn't have removeAll, so I used clear, and this seems to work just fine for removing a simple Composite consisting of a Grid.

What browser and OS are you using? Are you having this issue with development mode, production mode, or both? Also, would you be able to provide a simplified code example that implements EntryPoint?

CHEM_Eugene
1 Mar 2012, 11:31 PM
ContentPanel doesn't have removeAll, so I used clear

com.extjs.gxt.ui.client.widget.ContentPanel doesn't have clear method.

I have a bug in all browsers, production and dev. mode, Windows 7, gxt 2.2.5

EntryPoint code:



public void onModuleLoad() {

Mvp4gModule module = (Mvp4gModule) GWT.create(Mvp4gModule.class);
module.createAndStartModule();

final Viewport v = new Viewport();
v.setLayout(new FitLayout());
v.add((Widget) module.getStartView());
RootLayoutPanel.get().add(v);

}


Problem class:



public class MainView extends LayoutContainer implements
MainPresenter.MainViewInterface, ReverseViewInterface<MainPresenter> {

import com.extjs.gxt.ui.client.widget.ContentPanel;
import com.extjs.gxt.ui.client.widget.LayoutContainer;

private ContentPanel mainPanel = new ContentPanel();
private Widget defaultMainBody;
private Widget activeView;

public void setDefaultMainBody() {
if (!defaultMainBody.equals(activeView)) {
mainPanel.removeAll();
mainPanel.setHeading(getModuleTitle());
activeView = defaultMainBody;
mainPanel.add(defaultMainBody);
layout();
}
}
}

sven
2 Mar 2012, 12:38 AM
This is the GXT 3 bug forums, you are using GXT 2. I moved this thread to the proper location.

sven
2 Mar 2012, 12:39 AM
Can you please post a fully working testcase implementing EntryPoint without a reference to mvp4g?