February 18th, 2008 by Kyle
Tags: datagrid, Flex, idropinlistitemrenderer, ifocusmanagercomponent, itemeditor, itemrenderer
Posted in: Flex
Here is a sample that came about as usual, from working on an issue with a customer. I found I didn’t have a good example of a combobox itemEditor. This sample came about when moving from using a combobox as an inline editor to moving to a combobox within a custom component as an editor. Wrapping the combobox in a VBox within the custom component caused some errors and undesirable behavior. In order to wire up data and tabbing/focus behavior you have to remember you component should implement IDropInListItemRenderer and IFocusManagerComponent. See the following sample code and running sample:
App:
<mx:Application xmlns:mx="http://www.adobe.com/2006/mxml">
<mx:XML id="xml" source="weather.xml"/>
<mx:DataGrid id="myDatagrid" dataProvider="{xml.city}"
variableRowHeight="true" editable="true" rowHeight="50"
width="300" height="300">
<mx:columns>
<mx:DataGridColumn dataField="Location"/>
<mx:DataGridColumn dataField="Climate" editable="true" editorDataField="value">
<mx:itemEditor>
<mx:Component>
<mx:ComboBox editable="true">
<mx:dataProvider>
<mx:String>Mild</mx:String>
<mx:String>Hot</mx:String>
<mx:String>Foggy</mx:String>
<mx:String>Rainy</mx:String>
<mx:String>Snow</mx:String>
</mx:dataProvider>
</mx:ComboBox>
</mx:Component>
</mx:itemEditor>
</mx:DataGridColumn>
<mx:DataGridColumn dataField="CloudCoverPercent" editable="true" editorDataField="value"
itemEditor="CloudCover"/>
</mx:columns>
</mx:DataGrid>
</mx:Application>
11 Comments »


Recent Comments