You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@flex.apache.org by "Mark Kessler (JIRA)" <ji...@apache.org> on 2013/04/18 03:59:15 UTC

[jira] [Commented] (FLEX-28883) List.requireSelection doesn't always work

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

Mark Kessler commented on FLEX-28883:
-------------------------------------

Test app used below.  Successfully test bug existed.  The listbase.as dataProviderRefreshed was unselecting all selectedIndex/selectedItem/caret when the dataProvider was being refreshed and leaving it that way.  It now checks for requiredSelection. If it is enabled, then it will set the selectedIndex to the first index.  If it is disabled, it will continue to use previous code to remove the selection.

<?xml version="1.0" encoding="utf-8"?>
<!---
   Test application
-->
<s:Application xmlns:fx="http://ns.adobe.com/mxml/2009"
               xmlns:s="library://ns.adobe.com/flex/spark"
               xmlns:mx="library://ns.adobe.com/flex/mx" > 

    <fx:Script>
        <![CDATA[

        import mx.collections.ArrayCollection;

        [Bindable]
        public var myAC:ArrayCollection= new ArrayCollection(['A','B','C','D','E','F','G','H']); 
        
        private function filterAC(item:Object):Boolean
        {
            return false;
        }

        ]]>
    </fx:Script>

    <s:layout>
        <s:VerticalLayout horizontalAlign="center" verticalAlign="middle" gap="0" />
    </s:layout>

	<s:Button id="b1" label="Filter" click="myAC.filterFunction=filterAC;myAC.refresh();"/>
	<s:Button id="b2" label="UnFilter" click="myAC.filterFunction=null;myAC.refresh();"/>
	<s:List dataProvider="{myAC}" requireSelection="true" />

</s:Application>
                
> List.requireSelection doesn't always work
> -----------------------------------------
>
>                 Key: FLEX-28883
>                 URL: https://issues.apache.org/jira/browse/FLEX-28883
>             Project: Apache Flex
>          Issue Type: Bug
>          Components: Spark: List
>    Affects Versions: Adobe Flex SDK Previous
>         Environment: Affected OS(s): All OS Platforms
> Affected OS(s): All OS Platforms
> Browser: Other (specify version)
> Language Found: English
>            Reporter: Adobe JIRA
>            Assignee: Mark Kessler
>
> Steps to reproduce:
> 1. Create a ListCollectionView and a filterFunction to it.
> 2. Create a List set requireSelection to 'true' and apply the collection as the dataProvider to a List.
> 3. Filter the collection so that all items are removed.
> 4. Filter the collection so that items are added again.
>  
>  Actual Results: The list shows the items without any selection.
>  
>  
>  Expected Results: Due to 'requireSelection' being set to 'true', if the List displays items, one should be selected.
>  
>  
>  Workaround (if any): This is due to 'requireSelection' only being applied once in commitProperties after it is set. 
> commitProperties lines 907-920
> if (requireSelectionChanged)
>         {
>             requireSelectionChanged = false;
>             
>             if (requireSelection &&
>                     selectedIndex == NO_SELECTION &&
>                     dataProvider &&
>                     dataProvider.length > 0)
>             {
>                 // Set the proposed selected index here to make sure
>                 // commitSelection() is called below.
>                 _proposedSelectedIndex = 0;
>             }
>         }
>  
>  When a collection is reset or refreshed the 'requiredSelection' property should be checked and if true 'requireSelectionChanged' should be set to 'true' so that selection is forced again in commitProperties.

--
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