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>
Tweet
27 Comments »

Recent Comments