开发者

Flex datagrid multiple rows single file

I have a flex datagrid with 3 columns. The first column contains the image name(unique key). The other two开发者_运维知识库 columns have username and size details. I want to split the username into lastname, firstname, address and some other stuff.

Can we have multiple rows in the grid for one image? Tried multi-line, it works but we need to keep adding spaces and its cumbersome. Since each row in the flex datagrid is represented by one index in the XMLList which is enumerated, is there a way to have more than one row assigned to one image and shown in the grid? something like this..

http://www.freeimagehosting.net/uploads/b7f4e9c9ba.gif http://www.freeimagehosting.net/uploads/b7f4e9c9ba.gif

Thanks, Vish.


Use a custom itemRenderer for the user column. Here is a sample code snippet, you might want to modify it based on the structure of your dataProvider

<mx:DataGrid id="dg" width="100%" height="100%" dataProvider="{dp}">
    <mx:columns>
            <mx:DataGridColumn dataField="image" headerText="Image"/>
            <mx:DataGridColumn dataField="user" headerText="User" >
              <mx:itemRenderer>
                <mx:Component>
                  <mx:VBox>
                    <mx:Label text="{data.firstName}"/>
                    <mx:Label text="{data.lastName}"/>
                    <mx:Text text="{data.address}"/>
                  </mx:VBox>
                </mx:Component>
              </mx:itemRenderer>
            </mx:DataGridColumn>
            <mx:DataGridColumn dataField="size" headerText="Size"/>
    </mx:columns>
</mx:DataGrid>
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜