Good point.
Any idea how that's best approached - is there a built-in class that can handle this?
 
Stefan
 
 


From: [email protected] [mailto:[EMAIL PROTECTED] On Behalf Of Tracy Spratt
Sent: 30 March 2006 18:55
To: [email protected]
Subject: RE: [flexcoders] Re: databinding issue for combobox

It occurs to me that  dgDP.addItem(cboSource.selectedItem) is adding a reference to the object in the combobox dataProvider, not a new object.

 

This might be the problem.

 

Probably we should use some objectCopy function to create a new object.

 

Tracy

 


From: [email protected] [mailto:[email protected]] On Behalf Of Stefan Richter
Sent: Thursday, March 30, 2006 4:30 AM
To: [email protected]
Subject: RE: [flexcoders] Re: databinding issue for combobox

 

Sorry to hijack this thread.

 

Thanks for the example Tracy. I have somewhat changed it for Flex2 and run into a small issue. I am using 2 ArrayCollections, one for the combobox and one for the datagrid:

 

  [Bindable]
  public  var cbDP:ArrayCollection;
  [Bindable]
  public  var dgDP:ArrayCollection;
  
  public function initData():void
  {
   cbDP = new ArrayCollection(
    [ {label:"A", Number:0}, {label:"B", Number:1}, {label:"C", Number:2}]
   );
   dgDP = new ArrayCollection();
  }

 

I then 'shift' one item from the combobox to the datagrid:

 

  private function addRow():void
  {
   dgDP.addItem(cboSource.selectedItem); // cboSource is the actual component on stage
  }

 

This works fine. But when I add the same item multiple times to the datagrid then only ther last added item out of the group of same items is selectable in the datagrid. This must be an easy one to fix but I am not sure what is going wrong.

 

I noticed that the mx_internal_uid is the same for all 'same' items in the grid.

 

Any help appreciated.

 

Stefan

 

 

 

 




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




YAHOO! GROUPS LINKS




Reply via email to