Item Renderers

Visual representation of data items in lists and other collection components

Collections of data contain objects or items. Several components in Royale, like List, DataGrid, TabBar or ButtonBar, can show collections of data to the user in different ways. Those components need to describe each item and adapt the visualization to the data inside each object. Apache Royale uses Item Renderer components to render, or visualize, each piece of data in each collection object in a collection component.


The standard method is to declare an item renderer in a separate file which you then import into the component where you will be displaying the rendered data, but you can also declare an item renderer inline for convenience:

<j:DataContainer width="100%" labelField="name" dataProvider="{dataList}">
        <j:Viewport clipContent="false"/>
            <j:ListItemRenderer width="100%">
                    import vos.Provider;

                    public function get provider():Provider {
                        return data as Provider;
                <j:HGroup gap="3" itemsVerticalAlign="itemsCenter">
                    <js:FontAwesomeIcon text="{FontAwesome5IconType.PARKING_CIRCLE}" 
                                        style="color: {provider.color};"/>
                    <j:Label text="Offered by" className="weight-bold"/>
                    <j:Image width="60" height="24" src="{provider.logo}">
                            <js:ErrorImage emptyIsError="true"/>