Flex 数据网格自定义选项卡行为
我有两个数据网格,我想覆盖 tab 键事件的行为,以便当光标到达第一个数据网格列的末尾时它会转到下一个数据网格。
任何提示表示赞赏!
马库斯
I have two datagrids and I want to override the behavior of the tab-key event, so that it goes to the next datagrid, when the cursor reaches the end of the first datagrid columns.
Any hints are appreciated!
Markus
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
Markus,这是一个功能性演示,应该能让您走上正轨:
本质上,这是两个数据网格,中间有一个文本字段。如果您要从第一个网格的最后一个可编辑单元格自然地进行制表,它将首先转到文本字段,然后另一个制表事件会将焦点设置到第二个数据网格。
我说这“有点”实用,因为我似乎无法获得准确的 DataGrid.rowCount (它应该是 3,但由于某种原因读取为 6)。这就是为什么那里有 dg.rowCount / 2 检查的原因。
希望这能帮助你前进;)
Markus, this is a somewhat functional demo that should get you on the right track:
Essentially, this is two datagrids with a textfield in between them. If you were to tab naturally from the last editable cell of the first grid, it would go to the text field first, then another tab event would set focus to the second datagrid.
I said this was "somewhat" functional, as I can't seem to get an accurate DataGrid.rowCount (It should be 3, but for some reason reads 6). This is why there's a dg.rowCount / 2 check in there.
Hopefully this should help move you forwards though ;)
我发现 rowCount 的问题。 rowCount 并不代表网格中的数据量,它代表创建的行数...因此,如果您查看数据网格,您会发现每个网格都有 6 行!这就是为什么
为了获得正确数量的数据,我使用 dg.dataProvider.length...
再次感谢,它现在完美运行!
马库斯
I found the problem with the rowCount. The rowCount doesn't represent the amount of data in the grid, it represents the number of rows created... so if you look at the datagrid you see that each has 6 rows! thats why
To get the right amount of data I use dg.dataProvider.length...
Thanks again, it works now perfectly!
Markus