mx:Tree 未调度“itemClick”单击图标时的事件

发布于 2024-09-05 18:02:37 字数 404 浏览 2 评论 0原文

当我们将 defaultLeafIcon={null} 并将folderClosedIcon 和folderOpenIcon 设置为{null} 时,我有一个 Flex 树,它工作得非常好。我们决定将图标放回去并去掉空值。现在它们显示得很好,但如果您单击图标而不是标签或行的其余部分,它似乎会更改所选项目,在新项目周围显示突出显示,但不会调度 ItemClick 事件。这使得很难知道树的所选项目已更改!奇怪的是,一旦您单击该图标一次并且看起来 selectedItem 发生了变化(或者至少它应用了该样式),如果您再次单击相同的图标,它实际上会触发 itemClick 事件。如果您单击任何其他图标,它会再次执行相同的操作,切换 selectedItem 并设置该行的样式,但不会触发 itemClick 事件。

有什么想法吗?谢谢。 (顺便说一句,这是在 Flex 4 中)

I have a flex tree that worked perfectly fine when we set the defaultLeafIcon={null} and the folderClosedIcon and folderOpenIcon to {null}. We decided to put the icons back in and took out the nulls. Now they show up fine, but if you click on the icon instead of the label or the rest of the row, it seems to change the selected item, shows the highlight around the new item, but doesn't dispatch the ItemClick event. This makes it really hard to know that the tree's selected item has changed! The weird part is that once you have clicked on the icon once and it looked like the selectedItem changed (or at least it applied that style), if you click the same icon again, it will actually fire the itemClick event. if you click any other icon, it does the same thing again, switching the selectedItem and styling that row, but not firing the itemClick event.

Any ideas? Thanks. (This is in flex 4 btw)

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

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

发布评论

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

评论(2

差↓一点笑了 2024-09-12 18:02:37

我们遇到了这个问题,事实证明,因为我们使用 SWF 作为源并引用 SWF 中的符号作为图标,然后单击该图标似乎拦截并隐藏了单击事件。这就是我们所拥有的:

[Embed(source='assets/icons.swf', symbol='folder')]
private var folderIcon:Class;

我们通过将图标转换为 PNG 文件解决了问题,一切正常。

[Embed(source='assets/folder.png')]
private var folderIcon:Class;

We had that problem and it turned out that because we were using a SWF as the source and referencing a symbol in the SWF as an icon, then clicking on that icon seemed to intercept and bury the click event. This is what we had:

[Embed(source='assets/icons.swf', symbol='folder')]
private var folderIcon:Class;

We solved the problem by converting the icons to PNG files and everything worked fine.

[Embed(source='assets/folder.png')]
private var folderIcon:Class;
阿楠 2024-09-12 18:02:37

不知道 Tree 组件是如何真正完成的

,但对于 AdvancedDataGrid 这有效:

<mx:AdvancedDataGrid>
        <mx:groupItemRenderer>
            <mx:Component>
                <mx:AdvancedDataGridGroupItemRenderer mouseEnabled="true"/>
            </mx:Component>
        </mx:groupItemRenderer>
</mx:AdvancedDataGrid>

也许

 <mx:Tree>
        <mx:itemRenderer>
            <mx:Component>
                <mx:TreeItemRenderer mouseEnabled="true"/>
            </mx:Component>
        </mx:itemRenderer>
    </mx:Tree>

don't know how it's really done for Tree component

but for AdvancedDataGrid this worked:

<mx:AdvancedDataGrid>
        <mx:groupItemRenderer>
            <mx:Component>
                <mx:AdvancedDataGridGroupItemRenderer mouseEnabled="true"/>
            </mx:Component>
        </mx:groupItemRenderer>
</mx:AdvancedDataGrid>

maybe

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