Flex 4 数据网格覆盖

发布于 2024-11-15 02:35:08 字数 229 浏览 2 评论 0 原文

我需要在数据网格单元格上绘制叠加层。我希望叠加层位于底层单元格数据之上并显示剖面线图案,即:水平线和垂直线,就像单元格中的迷你网格一样。

覆盖的想法是表明,当一段时间内没有收到数据时,数据就已经过时或过时了。

我很确定我需要在渲染器的 updateDisplayList() 中做一些事情,但我还没有使用绘图 API,所以我不知道如何做到这一点。

任何帮助将不胜感激。

谢谢 标记

I need to draw an overlay over a datagrid cell. I want the overlay to sit ontop of the underlying cell data and to display a crosshatch pattern ie: horizontal and vertical lines, like a mini-grid in the cell.

The idea of the overlay is to show that when no data has been received for a while then the data has become old or stale.

I'm pretty sure I need to do something in the updateDisplayList() of the renderer, but I haven't used the Drawing API so I am not sure how to do this.

Any help would be greatly appreaciated.

Thanks
Mark

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

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

发布评论

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

评论(1

何以畏孤独 2024-11-22 02:35:08

所以我想 ItemRenderer 有 2 种状态,一种称为“新”,一种称为“旧”,对吧?

一个好消息:您不需要重写 updateDisplayList 函数。 Flex SDK 4+ 为您提供名为 FXG 的图形实用程序。您可以访问此链接了解更多信息:http://help.adobe.com/en_US/flex/using/WS145DAB0B-A958-423f-8A01-12B679BA0CC7.html

在你的情况下,你可以这样做:

<?xml version="1.0" encoding="utf-8"?>
<s:ItemRenderer xmlns:fx="http://ns.adobe.com/mxml/2009" 
                xmlns:s="library://ns.adobe.com/flex/spark" 
                xmlns:mx="library://ns.adobe.com/flex/mx" width="50" height="50" click="currentState = 'old'">
    <fx:Declarations>
        <!-- Place non-visual elements (e.g., services, value objects) here -->
    </fx:Declarations>
    <s:states>
        <s:State name="new" />
        <s:State name="old" />
    </s:states>
    <s:BorderContainer width="50" height="50">
        <s:Label text="{data.toString()}" />
    </s:BorderContainer>
    <s:Path data="M 0 10 L 50 10 M 0 20 L 50 20 M 0 30 L 50 30 M 0 40 L 50 40 M 10 0 L 10 50 M 20 0 L 20 50 M 30 0 L 30 50 M 40 0 L 40 50"
            includeIn="old">
        <s:stroke>
            <s:SolidColorStroke color="black" weight="1" />
        </s:stroke>
    </s:Path>
</s:ItemRenderer>

想法:创建一条路径(绘制网格)并将其置于“旧”状态,每当项目更改为“旧”状态时,网格就会出现。

So I suppose you have 2 states for the ItemRenderer, one called "new", one "old", right?

One good news: You don't need to override updateDisplayList function. Flex SDK 4+ provides you graphics utility named FXG. You can visit this link for more information: http://help.adobe.com/en_US/flex/using/WS145DAB0B-A958-423f-8A01-12B679BA0CC7.html

In your case, you can do something like this:

<?xml version="1.0" encoding="utf-8"?>
<s:ItemRenderer xmlns:fx="http://ns.adobe.com/mxml/2009" 
                xmlns:s="library://ns.adobe.com/flex/spark" 
                xmlns:mx="library://ns.adobe.com/flex/mx" width="50" height="50" click="currentState = 'old'">
    <fx:Declarations>
        <!-- Place non-visual elements (e.g., services, value objects) here -->
    </fx:Declarations>
    <s:states>
        <s:State name="new" />
        <s:State name="old" />
    </s:states>
    <s:BorderContainer width="50" height="50">
        <s:Label text="{data.toString()}" />
    </s:BorderContainer>
    <s:Path data="M 0 10 L 50 10 M 0 20 L 50 20 M 0 30 L 50 30 M 0 40 L 50 40 M 10 0 L 10 50 M 20 0 L 20 50 M 30 0 L 30 50 M 40 0 L 40 50"
            includeIn="old">
        <s:stroke>
            <s:SolidColorStroke color="black" weight="1" />
        </s:stroke>
    </s:Path>
</s:ItemRenderer>

Idea: Create a path (draw your grid) and put it in state "old", whenever the item change to state "old", the grid will appear.

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