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

Justin Mclean edited comment on FLEX-33315 at 7/9/13 3:49 AM:
--------------------------------------------------------------

Slightly simpler example to show issue.


<?xml version="1.0" encoding="utf-8"?>
<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"
        applicationComplete="appInit()">

        <fx:Script>
                <![CDATA[
                        import mx.binding.utils.BindingUtils;
                        import mx.collections.ArrayCollection;
                        import mx.events.FlexEvent;
                        import mx.events.ListEvent;
                        
                        
                        [Bindable] private var dp:ArrayCollection = new 
ArrayCollection();
                        
                        protected function dgChange(event:ListEvent):void {
                                trace(grid.selectedItems);
                        }
                        
                        protected function appInit():void {
                                var timer:Timer = new Timer(500, 1);
                                
timer.addEventListener(TimerEvent.TIMER_COMPLETE, addItems);
                                timer.start();
                        }
                        
                        protected function addItems(event:Event):void {
                                dp.addItem("test");
                                dp.addItem("test2");
                                dp.addItem("test3");
                        }
                        
                        protected function dgInit(event:FlexEvent):void {
                                grid.selectedItems = [];
                        }
                        
                ]]>
        </fx:Script>
        <mx:AdvancedDataGrid allowMultipleSelection="true" id="grid"
                                                 dataProvider="{dp}"
                                                 
creationComplete="dgInit(event)"
                                                 change="dgChange(event)" />
</s:Application>

                
      was (Author: jmclean):
    Slightly simple example to show issue.


<?xml version="1.0" encoding="utf-8"?>
<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"
        applicationComplete="appInit()">

        <fx:Script>
                <![CDATA[
                        import mx.binding.utils.BindingUtils;
                        import mx.collections.ArrayCollection;
                        import mx.events.FlexEvent;
                        import mx.events.ListEvent;
                        
                        
                        [Bindable] private var dp:ArrayCollection = new 
ArrayCollection();
                        
                        protected function dgChange(event:ListEvent):void {
                                trace(grid.selectedItems);
                        }
                        
                        protected function appInit():void {
                                var timer:Timer = new Timer(500, 1);
                                
timer.addEventListener(TimerEvent.TIMER_COMPLETE, addItems);
                                timer.start();
                        }
                        
                        protected function addItems(event:Event):void {
                                dp.addItem("test");
                                dp.addItem("test2");
                                dp.addItem("test3");
                        }
                        
                        protected function dgInit(event:FlexEvent):void {
                                grid.selectedItems = [];
                        }
                        
                ]]>
        </fx:Script>
        <mx:AdvancedDataGrid allowMultipleSelection="true" id="grid"
                                                 dataProvider="{dp}"
                                                 
creationComplete="dgInit(event)"
                                                 change="dgChange(event)" />
</s:Application>

                  
> selectedItem returns [] after setting it to [], and selecting an item
> ---------------------------------------------------------------------
>
>                 Key: FLEX-33315
>                 URL: https://issues.apache.org/jira/browse/FLEX-33315
>             Project: Apache Flex
>          Issue Type: Bug
>          Components: Advanced Data Grid
>    Affects Versions: Adobe Flex SDK 4.6 (Release)
>         Environment: ALL
>            Reporter: Ryan
>            Assignee: Justin Mclean
>             Fix For: Apache Flex 4.10.0
>
>         Attachments: testProj.mxml
>
>
> Setting AdvancedDataGrid's selectedItems to [] in the grid's creation 
> complete handler causes it to never update it's selected items array (if the 
> dataprovider is initially empty).
>   
> Expected:   selectedItems has the selectedItems that are visually represented 
> by the grid.
> Results:  selectedItems is always empty.

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