Macromedia Flex Macromedia Flex
ComboBox itemRenderer with row-level list options
  Home

Nov 25, 2007 - ComboBox itemRenderer with row-level list options
An extended ComboBox, wrapped in itemRenderer

Often we need a ComboBox item renderer in a dataGrid column.  The ComboBox needs to display the currently selected item for each row, must update the dataProvider item when the user selects an option in the dropList, and must optionally be able to get its droplist items dynamically from the main item.

The attached example uses an extended ComboBox to do the item <=> value synchronization, and then wraps that in an itemRenderer to allow specifying both the list dataProvider source, and the "field" in the list dataProvider items that contains the option values.

There are sample three renderers, each using a different main dataProvider and different ways to get the ComboBox list items.

The requirements for functionality and abstraction make example a bit more complex, consisting of 5 files, but each component is quite simple, so take a look if you need this functionality.

I am not using this in production anywhere, so consider it just an example.

Zip file contents:
TestCBORenderer.mxml  -- The test app
ComboBoxSelectedValue.mxml -- provides the value to list synchronization
DGIR_DynamicDP.mxml -- DataGrid ItemRenderer with dynamic CBO lists
DGIR_DynamicDP_XML.mxml -- DataGrid ItemRenderer with dynamic CBO XMLList
DGIR_StaticDP_XML.mxml -- DataGrid ItemRenderer with Static CBO List in Array variable

Tracy Spratt

**** Click To View The Attached File - ComboBox itemRenderer with row-level list options

File Details
Created On Nov, 25, 2007 by Tracy Spratt
Last Modified On Nov, 25, 2007 by Tracy Spratt
Group: Tips and Articles
Flex Versions: 2.0
Category: Item Renderers/Editors
Type: Complete Lesson
Difficulty: Intermediate
Keywords: