开发者

Flex 4.1 Spark List clears selectedItems property when changing dataprovider

I found an issue in the Flex framework. I use Flex 4.1. In skin class of the MySkinnableContainer, List component defined:

<s:List id="myList" allowMultipleSelection="true"/>

Then in MySkinnableContainer, I dynamically change myList.dataProvider and myList.selectedItems. 开发者_JS百科But, when I am define myList.dataProvider = new ArrayCollection([1,2,...]), the myList.selectedIndices doesn`t clear. I catch exception when call myList.selectedItems, because myList.selectedIndices is old. myList.selectedIndices = [], and so on, doesnt work. Help me, please. Thank, you.


Fixed. Solution is, by steps:

  1. First, when you set dataProvider = new myArrayCollection([1,2...]), then, you must waiting for updateComplete event - the selectedItems and selectedIndices now is clear.
  2. Second, you can set your own selectedItems, ex. selectedItems = new Vector.int(), and before you call getter selectedItems, you must waiting for valueCommit event.
  3. Third, now you can call getter selectedItems wothout exception.
0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜