Question

GXT 2.25.

I have a screen with a layout container with a TableLayout with two columns. The left column has a tree grid. The right column is a layout container with table layout, one column.

When I click on various items on the tree grid, I want to display editable fields in the layout container on the right that match to the item clicked on.

When I first start the form and am loading the data from the server, I add text to the layout container and it seems to be fine.

After the text is loaded, I call secondLayout.removeAll() to remove all items. Then I click on an item in the tree. The selection method calls secondLayout.removeAll() and then adds a new text item "Loaded..." for testing.

private   LayoutContainer                     secondaryLayout;

And then...

secondaryLayout.removeAll();
secondaryLayout.add(new Text("Loaded..."));

Ideas?

Was it helpful?

Solution

After making structural changes to a container, be sure to invoke (in GXT 2) the layout method to re-run the layout routines. The alternative is to configure the LayoutContainer to re-run layouts on each modification (using setLayoutOnChange), but that would in this case be at least two re-layouts - one for removeAll, and another for each new object added. Could be needlessly expensive, so better to run once and for all when you are finished making changes.

(Worth pointing out perhaps that GXT 2.2.5 is just over two years old, 2.2.6, 2.3.0 have gone out since then, and it is being superseded by GXT 3. In GXT 3, the method here would be forceLayout.)

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top