[ 
https://issues.apache.org/jira/browse/FLEX-33398?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13582026#comment-13582026
 ] 

Alex Harui commented on FLEX-33398:
-----------------------------------

Joao, that's exactly my reasoning for not doing it in the component.  The 
component only knows it is an ICollectionView or IList and therefore can only 
execute a linear search.  If you want to restore the selectedItem when changing 
out the dataprovider, you should probably be using a data structure that 
supports fast search to compute the new selectedIndex and then set 
selectedIndex which is much faster than setting selectedItem.  I would not want 
to force every dataprovider reset do to a linear search.
                
> ComboBox loses selectedItem when dataProvider dispatch reset event
> ------------------------------------------------------------------
>
>                 Key: FLEX-33398
>                 URL: https://issues.apache.org/jira/browse/FLEX-33398
>             Project: Apache Flex
>          Issue Type: Bug
>          Components: mx: ComboBox
>            Reporter: João Fernandes
>   Original Estimate: 1m
>  Remaining Estimate: 1m
>
> During a reset Event, combobox does reset the selectedItem but doesn't 
> respect the fact the current selectedItem might be included in the new source.
> What I propose is to change
>  else if (ce.kind == CollectionEventKind.RESET)
>             {
>                 collectionChanged = true;
>                 if (!selectedIndexChanged && !selectedItemChanged)
>                     selectedIndex = prompt ? -1 : 0;
>                 invalidateProperties();
>             }
> to 
>  else if (ce.kind == CollectionEventKind.RESET)
>             {
>                 collectionChanged = true;
>                 if (!selectedIndexChanged && !selectedItemChanged && 
> !collection.contains(selectedItem))
>                     selectedIndex = prompt ? -1 : 0;
>                 invalidateProperties();
>             }

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators
For more information on JIRA, see: http://www.atlassian.com/software/jira

Reply via email to