Use two data fields in one itemRenderer : DataGrid Renderer « Grid « Flex






Use two data fields in one itemRenderer

Use two data fields in one itemRenderer
  
<?xml version="1.0"?>
<mx:Application xmlns:mx="http://www.adobe.com/2006/mxml">
    <mx:Script>
    
        import mx.collections.ArrayCollection;
        public var localVar:String="localVar";

        [Bindable]
        private var myData:ArrayCollection = new ArrayCollection([
            {CD:'A', CDName:'aa',Price:1.9, Cover:'a.jpg'},
            {CD:'B', CDName:'bb',Price:1.9, Cover:'b.jpg'}
        ]);
  
    </mx:Script>
    <mx:DataGrid id="myGrid" dataProvider="{myData}" variableRowHeight="true">
        <mx:columns>
            <mx:DataGridColumn dataField="CD"/>
            <mx:DataGridColumn dataField="CDName">
                <mx:itemRenderer>
                    <mx:Component>
                        <mx:VBox>
                            <mx:Text id="albumName" width="100%" text="{data.CDName}"/>
                            <mx:Image id="albumImage" height="45" source="{data.Cover}"/>
                        </mx:VBox>
                    </mx:Component>
                </mx:itemRenderer>
            </mx:DataGridColumn>
            <mx:DataGridColumn dataField="Price"/>
        </mx:columns>
    </mx:DataGrid>
</mx:Application>

   
    
  








Related examples in the same category

1.Inline item renderer that contains multiple controlsInline item renderer that contains multiple controls
2.NumericStepper renderer and editor for DataGridNumericStepper renderer and editor for DataGrid
3.DateField renderer and editor for DataGridDateField renderer and editor for DataGrid
4.CheckBox renderer and editor for DataGridCheckBox renderer and editor for DataGrid
5.Use Image control as item rendererUse Image control as item renderer
6.Use Component as itemRenderer for DataGridUse Component as itemRenderer for DataGrid
7.Inline Item Renderers for DataGridInline Item Renderers for DataGrid
8.Disable DataGrid cell rendererDisable DataGrid cell renderer
9.DataGrid Drop In Image RendererDataGrid Drop In Image Renderer
10.Inline DataGrid RendererInline DataGrid Renderer