开发者

How to enable tab key navigation on a datagrid where the cells are custom item renderers?

This is a snippet of code in our custom item renderer which is in 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();

Right now tab navigation works (on tab, focus 开发者_如何学运维goes to next editable cell) with the alert inserted in the code but I'm not sure why because I believe the alert in the code breaks the flow of event bubbling. However without the alert (which is what we are going for) the focus goes to the next grid in our UI.

You can see the attempts of trying to stop the event from going to other components. I have also tried to call preventDefault() and stopPropagation() on the datagrid when it receives a tab key event.

Any ideas on how to allow proper tab key navigation without an alert?


Try this:

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

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜