Search code examples
xmlapache-flexactionscriptadobemxml

How to get a line break inside a <mx:GridItem> tag in flex?



I am a newbie to Flex and I am stuck in this since hours.

The mxml file structure that I have is as follows :-

<mx:Grid>
.
.
.
<mx:GridRow>
<mx:GridItem>
     <mx:Text text="blah blah" visible="some condition"/>
     <mx:Repeater dataprovider="something something" visible="xyz">
          <AnotherFileCalled paddingLeft = "5">
     </mx:Repeater>
</mx:GridItem>

AnotherFileCalled is another mxml file that is getting data and this data is visible in the current mxml file.

So my question is how do I show each item from other file on a new line. I want to make sure every item coming from other file is shown on a new file. So how do I get this. I have tried using another Grid inside the Repeater and also tried using after each item, at every possible place. But I am not able to view each item from the external file on a new line.

The content that is visible to me right now is :-

Lets assume another file gets me information about the email addresses. So my work email, personal email can be listed from this file.

Currently it is visible as

Personal - asd@gmail.com Work - asdasdas@gmail.com

I want it to be visible as :-

Personal - asd@gmail.com 
Work - asdasdas@gmail.com

Thanks for your time.

Zingo


Solution

  • Here's what the documentation says about layout in a GridItem:

    The GridItem container defines a grid cell in GridRow container. (The GridRow container, in turn, defines a row in a Grid container.) The GridItem container can contain any number of children, which are laid out as in an HBox container. If you do not want HBox layout, create a container, such as a VBox container, as a child of the GridItem control and put other components in this child container.

    So you might try:

    <mx:GridItem>
        <mx:VBox>
            <mx:Text text="blah blah" visible="some condition"/>
            <mx:Repeater dataprovider="something something" visible="xyz">
                <AnotherFileCalled paddingLeft = "5">
            </mx:Repeater>
        </mx:VBox>
    </mx:GridItem>
    

    or

    <mx:GridItem>
        <mx:Text text="blah blah" visible="some condition"/>
        <mx:VBox>
            <mx:Repeater dataprovider="something something" visible="xyz">
                <AnotherFileCalled paddingLeft = "5">
            </mx:Repeater>
        </mx:VBox>
    </mx:GridItem>