开发者

Flex DataGrid autoscroll on dataProvider change

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 even开发者_如何学JAVAt 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?


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.


What if you select whatever was selected previously and use ensureIndexIsVisible()?

0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜