Flex DataGrid 在 dataProvider 更改时自动滚动
当我更新 dataProvider (ArrayCollection) 时,我的 Flex 数据网格会自动滚动到顶部。我不希望发生这种情况,但我仍然希望所有对象都更新。我正在为客户的管理系统开发一个半实时仪表板,该仪表板会经常更新。如果每次更新时都滚动到顶部,那么使用起来会非常困难和令人沮丧。
我尝试使用以下技术来防止这种情况发生,但没有任何效果。
dataProvider = updatedDataProvider;
dataProvider.updateItem(dataProvider);
dataProvider.source = updatedDataProvider.source;
dataProvider.updateItem(dataProvider);
我试图调度一个鼠标事件来将垂直滚动条固定到位,我试图将垂直滚动条位置值锁定到位(保存和重新分配)...
还有许多其他事件,这些只是弹出的前几个进入我的脑海。有人有什么想法吗?
My Flex datagrid automatically scrolls to the top when I update the dataProvider (ArrayCollection). I do not want this to happen, but I still want all of the objects to update. I am developing a semi-real time dashboard for a customer's management system, that will update often. If it scrolls to the top every time it updates, it will be very difficult and frustrating to use.
I've attempted to use the following techniques to prevent this, none have worked.
dataProvider = updatedDataProvider;
dataProvider.updateItem(dataProvider);
dataProvider.source = updatedDataProvider.source;
dataProvider.updateItem(dataProvider);
I've attempted to dispatch a mouse event to hold the vertical scrollbar in place, I've attempted to lock the vertical scrollbar position value in place (saving and reassigning)...
And many others, those are just the first few that popped into my head. Anyone have any ideas?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
已在 中得到回答当数据更改时,如何在 DataGrid 中保持选择?,检查它。
在此答案的基础上,如果索引在数据提供程序之间发生变化,即,如果在上面插入一行,您可能需要在新提供程序上执行 getItemIndex。
Already been answered in How do I maintain selection in a DataGrid when the data changes? , check it.
Building on top of that answer, if the index changes between data providers, ie, if a row is inserted above, you may want to do a getItemIndex on the new provider.
如果您选择之前选择的内容并使用 EnsureIndexIsVisible() 会怎么样?
What if you select whatever was selected previously and use ensureIndexIsVisible()?