带有条件链接的 Flex Datagrid
我需要你的帮助来关注。
我有一个数据网格,它使用数组列表作为数据提供者。现在我的要求是在该数组列表中,我有一个 statusId 作为一个变量,或者说我显示为数据网格中的列之一的属性。现在我有另一列,我必须在其中显示三个链接,例如编辑、删除和查看,这将基于 statusid。你能给我一些想法或例子吗
I need your help on following.
I have one datagrid which use an arraylist as a data provider. Now my requirment is in that arraylist i have one statusId as one variable or say property which i display as one of the column in datagrid. now i have another column where i have to display three links like edit, delete and view which will be based on the statusid. can you give me some idea or example
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
我不是 Flex 专家,但通常当您想要自定义 DataGrid 中列的外观时,您会使用 ItemRenderer,如标记所示。在项目渲染器中,您可以使用 Label 组件并设置一系列属性,使它们看起来像链接,然后根据您的情况启用/禁用它们。
下面是我突然想到的一些示例代码,但有以下注意事项:
为了方便起见,我使用内联项目渲染器,但更好的做法是将项目渲染器外部化到单独的 MXML 文件中。
I'm no Flex expert, but usually when you want to customise the appearance of a column in a DataGrid you use an ItemRenderer, as indicated by your tag. Within the item renderer, you could use Label components and set a selection of attributes that make them look like links, and then enable/disable them depending on your condition.
Here's some example code off the top of my head, with the following caveats:
I'm using an inline item renderer for convenience, but it is better practice to externalise your item renderers into separate MXML files.
感谢avik的帮助,它是部分正确的,因为对我来说,有很多条件我不能将其放入启用属性中。无论如何,我从我这边得到了解决方案:)
这是语法。
thanks avik for your help it is partially correct as for me there are lot of condition i can not put that in enabled attribute. anyway i got the solution from my side :)
here is the syntax.