I'm pretty new to Flex, so there's probably a good chance I'm missing something obvious, but in the first example code, everything works as expected. When not editing the cell, it shows a centered date as plain text. When editing, it shows a DateField editor. The second example is exactly the same as far as I can tell, other than the fact that it is an AdvancedDataGridColumn
. Using that code with an AdvancedDataGrid
, when I go into edit mode I can see the text from the normal item renderer behind the DateField
editor (between the text input and calendar icon). Did I do something wrong here? How c开发者_如何学Pythonan I hide that? Thanks in advance.
Example 1:
<mx:DataGridColumn id="endColumn"
dataField="endDate"
headerText="End"
editorDataField="selectedDate"
editable="true"
labelFunction="{this.formatDate}"
width="80"
textAlign="center" >
<mx:itemEditor>
<fx:Component>
<mx:DateField yearNavigationEnabled="true" formatString="DD/MM/YY" />
</fx:Component>
</mx:itemEditor>
</mx:DataGridColumn>
Example 2:
<mx:AdvancedDataGridColumn id="endColumn"
dataField="endDate"
headerText="End"
editorDataField="selectedDate"
editable="true"
labelFunction="{this.formatDate}"
width="80"
textAlign="center" >
<mx:itemEditor>
<fx:Component>
<mx:DateField yearNavigationEnabled="true" formatString="DD/MM/YY" />
</fx:Component>
</mx:itemEditor>
</mx:AdvancedDataGridColumn>
The space between the dateInput and the icon is normally transparent. I'm not sure why mx:DataGrid
hides the rendered text and the mx:AdvancedDataGrid
doesn't.
Anyway, there's an easy solution to your problem. Just paint the itemEditors background in the color you like. The following should work.
<mx:itemEditor>
<fx:Component>
<mx:DateField yearNavigationEnabled="true" formatString="DD/MM/YY">
<fx:Script>
<![CDATA[
protected override function updateDisplayList(unscaledWidth:Number, unscaledHeight:Number):void
{
graphics.beginFill(0xFFFFFF); // white
graphics.drawRect(0, 0, unscaledWidth, unscaledHeight);
graphics.endFill();
super.updateDisplayList(unscaledWidth, unscaledHeight);
}
]]>
</fx:Script>
</mx:DateField>
</fx:Component>
</mx:itemEditor>
精彩评论