Chapter 7. Renderers and Editors

The renderer, or item renderer, is a powerful and commonly used aspect of the Flex Framework that enables you to define components that will be used by data driven components to display arrays or collections of data. DataGrid, List, Tile, and ComboBox containers among others, use renderers, passing the data of each item in their data provider to a specified item renderer that then handles displaying and updating the data. Because Flex applications frequently make extensive use of tabular data and lists, understanding the most efficient way to display data and to edit that data once displayed is an important aspect of development with Flex.

The key to working with item renderers and item editors is understanding how the relationship between the item renderer and the parent component is defined by the Flex Framework. All item renderers must possess a data property that can be used by the parent component to set the relevant data item. How this data is displayed is entirely up to the developer; for example, you can use a simple “drop-in” item renderer or a custom component. Item renderers can also allow user edits of data, which will automatically update the data provider of the parent component.

The item editor functions quite differently, with the base mx.controls.List class creating an instance of the editor whenever an item renderer component is clicked. When that editor loses focus, the List attempts to read an editorDataField property that can be ...

Get Flex 3 Cookbook now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.