I think that the objects in your dataProvider must implement the IUID interface for selection to work.

 


From: flexcoders@yahoogroups.com [mailto:flexcoders@yahoogroups.com] On Behalf Of Lance Linder
Sent: Monday, March 27, 2006 1:08 PM
To: flexcoders@yahoogroups.com
Subject: [flexcoders] List Component Bug!!

 

Hello,

 

I was just converting a project from Beta1 to Beta2 and noticed a problem with all my List components that were bound to data providers which are collections of custom objects.

 

The problem is that the List selection highlight is stuck on the last item in the list.  Changing the provider to be an array collection made up of plain instances of the Object class fixes the problem.  The problem seems to effect anything that uses the List component (ComboBox, DataGrid…)

 

Has anyone else seen this and found a fix?  Using plain old Object instances are not an option.

 

Here is some sample code that shows the problem.

 

<?xml version="1.0" encoding="utf-8"?>

<mx:Application xmlns:mx="http://www.adobe.com/2006/mxml" xmlns="*" layout="absolute" preinitialize="initData()">

           

            <mx:Script>

                        <![CDATA[

                                   

                                    [Bindable]

                                    public var a:Array;

                                                                       

                                    private function initData():void {

                                               

                                                a = new Array();

                                   

                                                var myObj:MyObject = new MyObject();

                                                myObj.name = "neung";

                                                a.push(myObj);

                                               

                                                var myObj2:MyObject = new MyObject();

                                                myObj2.name = "saawng";

                                                a.push(myObj2);

                                               

                                                var myObj3:MyObject = new MyObject();

                                                myObj3.name = "saam";

                                                a.push(myObj3);

                                    }

                                   

                        ]]>

            </mx:Script>

           

            <mx:List x="10" y="10" dataProvider="{a}" width="200" height="200" labelField="name"></mx:List>

</mx:Application>

 

//------ MyObject.as -----------------

 

package {

 

            public class MyObject extends Object {

                        public var name:String;

            }

}




--
Flexcoders Mailing List
FAQ: http://groups.yahoo.com/group/flexcoders/files/flexcodersFAQ.txt
Search Archives: http://www.mail-archive.com/flexcoders%40yahoogroups.com




SPONSORED LINKS
Web site design development Computer software development Software design and development
Macromedia flex Software development best practice


YAHOO! GROUPS LINKS




Reply via email to