ItemRenderer 通过 ItemEditor 在 AdvancedDataGrid 上显示
我对 Flex 还很陌生,所以很可能我遗漏了一些明显的东西,但在第一个示例代码中,一切都按预期工作。不编辑单元格时,它会以纯文本形式显示居中日期。编辑时,它会显示一个 DateField 编辑器。据我所知,第二个示例完全相同,除了它是一个 AdvancedDataGridColumn
之外。将该代码与 AdvancedDataGrid
结合使用,当我进入编辑模式时,我可以看到 DateField
编辑器后面的普通项目渲染器中的文本(在文本输入和日历图标之间) 。我在这里做错了什么吗?我怎样才能隐藏它?提前致谢。
示例 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>
示例 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>
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 can 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>
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
dateInput 和图标之间的空间通常是透明的。我不确定为什么
mx:DataGrid
隐藏渲染的文本,而mx:AdvancedDataGrid
不隐藏。无论如何,有一个简单的方法可以解决您的问题。只需将 itemEditors 背景涂成您喜欢的颜色即可。以下应该有效。
The space between the dateInput and the icon is normally transparent. I'm not sure why
mx:DataGrid
hides the rendered text and themx: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.