Flex Datagrid 中的编辑/删除按钮

发布于 2024-10-06 14:36:44 字数 190 浏览 1 评论 0原文

我有一个灵活的数据网格,其中包含从服务填充的购物车项目。每行都有由自定义 ItemRenderer 提供的编辑/删除按钮。当我单击每个按钮时,我从 itemrenderer 发送一个事件,该事件调用服务以编辑/删除所选项目。

如何从 Itemerenderer 内的数据提供者获取产品的 id,以便与我的自定义事件一起发送?

提前致谢

I have a flex datagrid with cart items populated from a service. Each row has edit/delete buttons provided by a custom ItemRenderer. When I click each button I send an event from the itemrenderer which calls a service in order to edit/delete the selected item.

How can I get the id of the product form the dataprovider inside the Itemerenderer in order to send it with my custom event?

Thanks in advance

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

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

发布评论

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

评论(1

欲拥i 2024-10-13 14:36:44

使用 itemRenderer 的 DATA 属性。

Flex 帮助中有一个非常说明性的示例。如果您的dataProvider是:

<mx:ArrayList>
<fx:Object firstName="Bill" lastName="Smith" companyID="11233"/>
<fx:Object firstName="Dave" lastName="Jones" companyID="13455"/>
<fx:Object firstName="Mary" lastName="Davis" companyID="11543"/>
<fx:Object firstName="Debbie" lastName="Cooper" companyID="14266"/>
</mx:ArrayList>

您可以按如下方式访问数据项:

<?xml version="1.0" encoding="utf-8"?>
<!-- containers\spark\myComponents\MySimpleItemRenderer.mxml -->
<s:ItemRenderer xmlns:fx="http://ns.adobe.com/mxml/2009"
xmlns:mx="library://ns.adobe.com/flex/mx"
xmlns:s="library://ns.adobe.com/flex/spark">
<s:HGroup verticalCenter="0" left="2" right="2" top="2" bottom="2">
<s:Label text="{data.lastName}, {data.firstName}"/>
<s:Label text="{data.companyID}"/>
</s:HGroup>
</s:ItemRenderer>

Use the DATA property of the itemRenderer.

The Flex help has a very illustrative example. If your dataProvider is:

<mx:ArrayList>
<fx:Object firstName="Bill" lastName="Smith" companyID="11233"/>
<fx:Object firstName="Dave" lastName="Jones" companyID="13455"/>
<fx:Object firstName="Mary" lastName="Davis" companyID="11543"/>
<fx:Object firstName="Debbie" lastName="Cooper" companyID="14266"/>
</mx:ArrayList>

you can access the data item as follows:

<?xml version="1.0" encoding="utf-8"?>
<!-- containers\spark\myComponents\MySimpleItemRenderer.mxml -->
<s:ItemRenderer xmlns:fx="http://ns.adobe.com/mxml/2009"
xmlns:mx="library://ns.adobe.com/flex/mx"
xmlns:s="library://ns.adobe.com/flex/spark">
<s:HGroup verticalCenter="0" left="2" right="2" top="2" bottom="2">
<s:Label text="{data.lastName}, {data.firstName}"/>
<s:Label text="{data.companyID}"/>
</s:HGroup>
</s:ItemRenderer>
~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文