【问题标题】:How to enable tab key navigation on a datagrid where the cells are custom item renderers?如何在单元格是自定义项呈现器的数据网格上启用选项卡键导航?
【发布时间】:2011-05-26 19:48:26
【问题描述】:

这是我们自定义项目渲染器中的一段代码,它在 actionscript 中:

textCustomItemRendererTempForTab.tabEnabled=true;
textCustomItemRendererTempForTab.focusEnabled=true;
textCustomItemRendererTempForTab.setFocus();
Alert.show( "Without this alert focus goes to next grid   " );
keyboardEvent.preventDefault();
keyboardEvent.stopImmediatePropagation();
keyboardEvent.stopPropagation();

现在标签导航工作(在标签上,焦点转到下一个可编辑单元格),并在代码中插入警报,但我不确定为什么,因为我相信代码中的警报会破坏事件冒泡的流程。然而,如果没有警报(这是我们想要的),焦点会转到我们 UI 中的下一个网格。

您可以看到尝试阻止事件转到其他组件的尝试。我还尝试在数据网格收到 tab 键事件时调用 preventDefault() 和 stopPropagation()。

关于如何在没有警报的情况下允许正确的标签键导航有什么想法吗?

【问题讨论】:

  • 我在这里使用了这个例子:blog.flexexamples.com/2009/04/08/… 来快速关闭警报,但它可以工作,但是屏幕会闪烁,它充其量只是一个 hack。
  • 提供更多代码,我们或许能够提供更多帮助。从您提供的 sn-p ;很难说到底发生了什么。

标签: flash apache-flex datagrid itemrenderer


【解决方案1】:

试试这个:

keyboardEvent.preventDefault();
keyboardEvent.stopImmediatePropagation();
keyboardEvent.stopPropagation();
textCustomItemRendererTempForTab.tabEnabled=true;
textCustomItemRendererTempForTab.focusEnabled=true;
callLater(function():void {
    textCustomItemRendererTempForTab.setFocus();
});

【讨论】:

    猜你喜欢
    • 2011-07-24
    • 1970-01-01
    • 1970-01-01
    • 2012-08-24
    • 2011-03-25
    • 1970-01-01
    • 1970-01-01
    • 2014-10-30
    • 1970-01-01
    相关资源
    最近更新 更多