开发者

Flex Spark List not updating, missing items

I have a Spark.List with several items ("folders") each containing an ArrayList of files inside, when I select one of these "folders" it should display the list of "files" on another Spark.List. Its working right now by doing this:

private function onFolderChange (event:*):void {
    var list:List = event.currentTarget as List;

    if (list.selectedIndex != -1) {
        currentFolder = null;
        currentFolder = list.selectedItem;

        fileListDataProvider = currentFolder.files;
        fileList.selectedIndex = -1;
    }
}

The problem is that when the "file" thumbnails cover more then the List viewport and a scroll is needed sometimes by changing from a "folder" to another "folder" the file List loses files.

For example lets say there is a "Folder 1" with 30 "files" in it (10 visible and 20 hidden by the scroller) and "Folder 2" has 5 "files" (all visible), if I switch back and forth between "folders" sometimes it will display everything right, sometimes it will display a scroll on "Folder 2" when there is no need and sometimes it will only display a few (5 or 10) "files" in "Folder 1" 开发者_运维问答even though it has 30.

Something is wrong with the fileList, its updating its items but not really updating well. I've tried setting the itemRenderer to null and reapplying, setting the dataProvider to null and reapplying, doing validateNow().... I'm kinda lost.

Any thoughts?


Why don't you use direct databinding?

<s:List id="folders" dataProvider="{folderList}" />
<s:List id="files" dataProvider="{folders.selectedItem?folders.selectedItem.files:null}" />

For your problem, try playing with useVirtualLayout or updateDisplayList()...

0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜