P0ulBogd
P0ulBogd

Reputation: 77

Resize GXT Grid

How i can make this grid:

enter image description here When I move SplitPanel grid dynamically expanding along with the columns. Grid in the picture I made manually adding width: 100% If I use this:

grid.setWidth("100%");
grid.setHeight("100%");

It is not working, i get this:

enter image description here

I found this: click

But GXT 3.* not have FitLayout

Any ideas?

Upvotes: 0

Views: 1912

Answers (1)

Colin Alworth
Colin Alworth

Reputation: 18331

There is no fit layout in gxt 3 because the cases where it would be needed, no layout at all is required! Any container that accepts only one child (or only one child in a particular position like the NorthSouthContainer or BorderLayoutContainer) will always size it to the space available. All layouts are covered at http://www.sencha.com/learn/sencha-gxt-2x-to-300-migration-guide/#h.ys84m7uvflvk describing what existed in 2.x and its parallel in 3.

That said, the SplitPanel class is deprecated, as both it and all subclasses only work in quirks mode. In contrast, GXT 3 only works in standards mode. The SplitLayoutPanel class could work instead, though it uses the RequiresResize interface to detect how the child can be resized. GXT widgets don't all use this, though the containers do: if you are using the SplitLayoutPanel, it should be possible to wrap your grid in a SimpleContainer so that the container gets the details from its parent (the split layout panel) and passes the new size details on to the grid.

If you're more familiar with GXT 2, instead of either of the above, look at the BorderLayoutContainer - you'll be able to add the Grid directly to it, since the border layout container knows to give size details directly to the grid, rather than it informing it that the size has changed and it should measure itself.

One last note - from your screenshot, the root widget isn't drawing in the upper left corner of the browser window as it should. Two main causes for that, either you are missing the reset.css (see setup.txt in the gxt zip), or you are using the GWT theme Clean, which adds a margin in that area. You might find the app looks better without that extra space from where the browser ends to where the app begins.

Upvotes: 2

Related Questions