Tuesday, March 30, 2010

100% height does not work for Grid?

Hello again,

It seems that setting height to 100% for the Grid layout container does not work.?I would expect the bottom edge of the grid to stop before flowing off of the screen and a vertical scrollbar to appear ON THE GRID. But instead, it will flow below the bottom of the screen and a vertical scrollbar will appear on the parent container (in this case, an HBox, VBox, etc) and I have to scroll the whole parent container down to get to the bottom of the grid.

Example:

%26lt;mx:HBox height=100%''%26gt;

%26lt;mx:Grid?width=''500'' height=''100%'' %26gt;

?%26lt;mx:GridRow%26gt;

%26lt;mx:GridItem%26gt;

?%26lt;mx:Label text=''123''/%26gt;

%26lt;/mx:GridItem%26gt;

?%26lt;/mx:GridRow%26gt;

.

.

?[bunch of these repeated...]

?.

?.

?%26lt;mx:GridRow%26gt;

%26lt;mx:GridItem%26gt;

?%26lt;mx:Label text=''123''/%26gt;

%26lt;/mx:GridItem%26gt;

?%26lt;/mx:GridRow%26gt;

%26lt;/mx:Grid%26gt;

%26lt;/mx:HBox%26gt;

100% height does not work for Grid?

As soon as posted this, I got an idea which kinda/sorta works.?But I'd still like to know if there's a better way or what the deal is.

I set the Grid's default height to 0, then in the resize event for the parent box, I set the grid's height equal to the parent container's height (minus a little to prevent an 2nd outer scrollbar).?See below.

%26lt;mx:HBox id=''outer'' height=100%'' resize=''inner.height = outer.height - 5''%26gt;

%26lt;mx:Grid id=''inner''?width=''500'' height=''0'' %26gt;

?%26lt;mx:GridRow%26gt;

%26lt;mx:GridItem%26gt;

?%26lt;mx:Label text=''123''/%26gt;

%26lt;/mx:GridItem%26gt;

?%26lt;/mx:GridRow%26gt;

.

.

?[bunch of these repeated...]

?.

?.

?%26lt;mx:GridRow%26gt;

%26lt;mx:GridItem%26gt;

?%26lt;mx:Label text=''123''/%26gt;

%26lt;/mx:GridItem%26gt;

?%26lt;/mx:GridRow%26gt;

%26lt;/mx:Grid%26gt;

%26lt;/mx:HBox%26gt;

100% height does not work for Grid?

Try to add this on Canvas

Hi Natasha,

Thank you for the suggestion.?But unfortunately it still gives me the same behavior.?I still have to scroll down (using an outer scrollbar) to get to the grid's horizontal scrollbar at the bottom which has gone off screen.

No comments:

Post a Comment