这是我们的自定义项呈示器中的代码片段,位于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键事件时在datagrid上调用preventDefault()和stopPropagation()。
关于如何在没有警报的情况下允许正确的标签键导航的任何想法?
答案 0 :(得分:0)
试试这个:
keyboardEvent.preventDefault();
keyboardEvent.stopImmediatePropagation();
keyboardEvent.stopPropagation();
textCustomItemRendererTempForTab.tabEnabled=true;
textCustomItemRendererTempForTab.focusEnabled=true;
callLater(function():void {
textCustomItemRendererTempForTab.setFocus();
});