开发者

Flex 3 Adding image in datagrid

开发者 https://www.devze.com 2023-01-01 11:51 出处:网络
How do i add a image to a column in the datagrid? Currently my code is <mx:DataGridColumn dataField=\"image\" headerText=\"Photo Image\" editable=\"false\">

How do i add a image to a column in the datagrid?

Currently my code is

<mx:DataGridColumn dataField="image" headerText="Photo Image" editable="false">
                <mx:itemRenderer>
                    <mx:Component>
                    <mx:HBox height="30" horizontalAlign="center">
                        <mx:Image source="{'assets/image.jpg'}"/>
                    </mx:HBox>
 开发者_StackOverflow中文版                   </mx:Component>
                </mx:itemRenderer>
</mx:DataGridColumn>

WGere the dataField = "image" is the name of the picture file.


See below... assuming "image" only has the filename, and not the path of "assets/"

<mx:DataGridColumn dataField="image" headerText="Photo Image" editable="false"> 
                <mx:itemRenderer> 
                    <mx:Component> 
                    <mx:HBox height="30" horizontalAlign="center"> 
                        <mx:Image source="{'assets/' + data.image}"/> 
                    </mx:HBox> 
                    </mx:Component> 
                </mx:itemRenderer> 
</mx:DataGridColumn> 

If the full path to the image is indeed stored in "image", then use this

<mx:Image source="{data.image}"/> 
0

精彩评论

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