Flex DataGrid 在 DataGridColumn 上具有可变自定义 itemEditor

发布于 2024-09-06 04:20:05 字数 635 浏览 4 评论 0原文

是否有办法根据 dataField 值创建自定义项目编辑器?例如:

<mx:DataGrid editable="true" dataProvider="{_actionArr}" id="prop">  
  <mx:column>
    <mx:DataGridColumn headerText="Component" editable="false" dataField="label"/>
    <mx:DataGridColumn headerText="Value" editable="true" itemEditor="{data.ie}"/>
  </mx:columns> 
</mx:DataGrid>

...

[Bindable] private var _actionArr:Array = [   
{ label:"Slider", val:"", ie:mx.controls.HSlider },   
{ label:"ComboBox", val:"", ie:mx.controls.ComboBox  },   
{ label:"Button", val:"", ie:mx.controls.Button}];

Is there anyway to create a custom item editor based on the dataField value? For example:

<mx:DataGrid editable="true" dataProvider="{_actionArr}" id="prop">  
  <mx:column>
    <mx:DataGridColumn headerText="Component" editable="false" dataField="label"/>
    <mx:DataGridColumn headerText="Value" editable="true" itemEditor="{data.ie}"/>
  </mx:columns> 
</mx:DataGrid>

...

[Bindable] private var _actionArr:Array = [   
{ label:"Slider", val:"", ie:mx.controls.HSlider },   
{ label:"ComboBox", val:"", ie:mx.controls.ComboBox  },   
{ label:"Button", val:"", ie:mx.controls.Button}];

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

友欢 2024-09-13 04:20:05

我过去通过创建一个包含所有三个控件的自定义渲染器来处理此问题,并通过在渲染器上设置数据时检查数据类型来确定哪一个是可见的。您可以通过重写 set data 方法并相应地设置三个控件上的visible 和includeInLayout 属性来完成此操作。希望有帮助。

I've handled this in the past by creating a custom renderer that contains all three controls and determining which one is visible by checking the data type when the data gets set on the renderer. You do this by overriding the set data method and setting the visible and includeInLayout properties on the three controls accordingly. Hope that helps.

羁拥 2024-09-13 04:20:05

有点晚了答案...您可以使用 ClassFactory。 Farata Systems 已发表博客(http://flexblog.faratasystems.com/2006 /09/26/ditemrenderers-vs-itemeditors)对此以及他们的书中有更详细的解释。

A tad late answer... You can use ClassFactory. Farata Systems has blogged(http://flexblog.faratasystems.com/2006/09/26/ditemrenderers-vs-itemeditors) on this and a more detailed explanation in their book.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文