Hi,
I get a strange behavior where calling ensureIndexIsVisible doesn't show the correct item.
Am I missing the correct event to listen to after adding items to list data provider?
Description:
I use spark.components.List with an HorizontalLayout to display my data.
My data is displayed using ItemRenderer's.
After adding new items to the dataProvider I register to Event.RENDER and within this handler I call ensureIndexIsVisible and unregister to this event.
// adding some data to dataProvider - a few thousnd items
list.dataProvider.add(...)
list.addEventListener(Event.RENDER,
function renderHandler(e:Event):void
{
// show index
list.ensureIndexIsVisible(indexToShow);
list.removeEventListener(Event.RENDER, renderHandler);
});
Debugging I've done:
1. If I comment out removeEventListener, it will eventually work after a few times the event fires.
2. The initial location that I see is a few items behind so if i scroll a little I can find the desired item
Thanks,
Roy.
This blog post might be useful: http://flexponential.com/2011/02/13/scrolling-to-the-bottom-of-a-spark -list/
North America
Europe, Middle East and Africa
Asia Pacific