Flex Cairngorm - 如何在不失去数据网格焦点的情况下更新模型?
在我使用 Cairngorm 的 Flex 项目中,我有一个模型,用于存储由 DataGrid 显示的可绑定 ArrayCollection。当响应者更新模型时(在“更新”事件之后,从 Java 服务)更新模型时,就会出现我的问题,因为位于 DataGrid 单元格中的焦点丢失了(滚动位置也丢失了)。因此,我使用 DataGridEvent.ITEM_FOCUS_IN 事件检索更新前的位置:
myModel.focusedCell.rowIndex = e.rowIndex;
myModel.focusedCell.columnIndex = e.columnIndex;
但是,从哪里恢复这些参数?如何仅在模型更新时触发此更新?
提前致谢。
In my Flex Project using Cairngorm, I have a model that stores a bindable ArrayCollection displayed by a DataGrid. My problem occurs when the model is updated by the responder (from a Java service, after an "update" event), because the focus located in a cell of the DataGrid is lost (the scroll position il also lost). So, I retrieve the position before the update, with DataGridEvent.ITEM_FOCUS_IN event :
myModel.focusedCell.rowIndex = e.rowIndex;
myModel.focusedCell.columnIndex = e.columnIndex;
But, from where restore these parameters ? How to trigger this update only when the model is updated ?
Thanks in advance.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
有关信息,我解决了我的问题如下:
为了避免失去焦点(或者更确切地说正在编辑的下一个单元格),必须更新模型而不重新实例化它。
之后,我们必须解决滚动问题,如下文所述:
如何在不向上滚动的情况下绑定DataGrid组件数据?
for information, I resolved my problem as follows:
to avoid losing focus (or rather the next cell being edited), one has to update the model without re-instantiating it.
After that, we must resolve a problem with the scroll as explained in the following post:
How to data bind DataGrid component without scrolling up?