Hi Hugo, Yes, that problem has given me a lot of headaches and "in the end" it was stronger than me. As I see that you are also with this issue I could reactivate it and see if, between the two of us, we can give a good solution (I think we have discussed this same issue several times in this list and in the users list).
In my case I took as reference Jewel List and its "scrollToIndex" (that we debugged it with Carlos some time ago). From my point of view, when you refresh the dataprovider, as well as when you assign a selectedIndex, the list must be positioned in that element and make it visible. I managed to solve it in VirtualComboBox but with the VirtualList it didn't work too well; moreover, if the control "is not visible" when the dataprovider is assigned, the elements are NOT CREATED correctly. I know I was close to the solution, but I was stuck and, at the time, there were no people using these controls and they couldn't give me any additional support. I seem to remember that I implemented and debugged it in the royal-examples-community project but my memory may fail me.... I will be happy to try to solve these problems together with you, I don't have much time now, but I can try again with you if you agree. Let me know if we can do it and I will look for the implementation. Hiedra -----Mensaje original----- De: Hugo Ferreira <hferreira...@gmail.com> Enviado el: sábado, 21 de octubre de 2023 12:17 Para: dev@royale.apache.org Asunto: Function to refresh a VirtualList Hi, I didn't post on Royale mailing list for a while. Very busy. I use VirtualList and VirtualDataGrid however they are not perfect. One thing that always bothered me was that if I need for example to remove an element of the list, then I need to refresh the dataProvider and I have to notify the List, losing the selectedItem and scroll position. This gives a very bad experience to the user. I finally put time on this and did this working for me. Works on the top item (the easy ones), works on the middle of the list (the chalange ones because it's a Virtual container) and also works for the last item. The code it's not 100% beatutifull for the eye (the reason to not push to the repository), however the issue is also chalanging. If someone have the same issue as I did, here my solution (for now). Next I will do the same for DataGrid and should be similar to this solution. If someone have a more elegant solution or find out an improvement that I missed, please reply. public function refresh():void { var index:int = selectedIndex; var top:int = element.scrollTop; var oldDataProvider:Object = dataProvider; dataProvider = null; dataProvider = oldDataProvider; if ((dataProvider as IArrayList).length > 0) { selectedIndex = index; element.scrollTop = top; //during the tests I found some inconsistence, so it's need a delay before select the item setTimeout(function():void { var itemRenderer:IItemRenderer = (view as VirtualListView).getItemRendererForIndex(selectedIndex); if (itemRenderer != null) itemRenderer.element.click(); }, 500); setFocus(); } }