Both arrayCollections hold the same "type" of object, correct?

If so, couldn't you do:

rightArrayCollection.addItem( leftArrayCollection.selectedItem );
leftArrayCollection.removeItemAt( leftArrayCollection.selectedIndex );

>-----BEGIN PGP SIGNED MESSAGE-----
>Hash: SHA1
> 
>On the right datagrid I have the data provider set to a public bindable 
>array collection of NotifySchoolCorporations.
>
>When a potential user clicks the button that moves an entry from the 
>left to the right I have the following code:
>
>var TempObj:Object = new Object();
>TempObj.ID = AvailableSchoolCorporations.selectedItem.ID;
>TempObj.Name = AvailableSchoolCorporations.selectedItem.Name;
>NotifySchoolCorporations.addItem(TempObj);
>
>
>The Array Collection for the Left DataGrid is 
>AvailableSchoolCorporations which is populating and when I click on one 
>Entry and click the Button, in my Alert.show line I see the value of 
>TempObj.ID and TempObj.Name which is the values of the item I have 
>selected. When I run the application I am getting an error message of:
>
>Error #1009: Cannot access a property of a null object reference on line 
>46. Line 46 is the NotifySchoolCorporations.addItem(TempObj);
>
>
>Dave Watts wrote:
>|> I am working on a new flex application which on my stage is 2
>|> DataGrids separated by 2 buttons. One of hte buttons has an
>|> arrow pointing to the right and the other button has an arrow
>|> pointing to the left. The datagrid on the left hand side is
>|> populated via a Coldfusion CFC that lists all of the Business
>|> within a 25 mile radius of a specific zipcode.
>|>
>|> Now when I click on one of these businesses and click t he
>|> button with the arrow pointing to the right, I am able to
>|> display the Business in the Right datagrid with the following
>|> bit of code.
>|>
>|> private function updateSchoolCorpNotify():ArrayCollection {
>|> ~    var arr:Array = [];
>|> ~    
>|> arr.push({Name:AvailableSchoolCorporations.selectedItem.Name,I
>|> D:AvailableSchoolCorporations.selectedItem.ID});
>|> ~    return new ArrayCollection(arr);
>|> }
>|
>| Create two ArrayCollection objects. On the event that moves records 
>from one
>| datagrid to the other, find the selected item in the left grid, then use
>| addItem to create a corresponding item in the second - your function 
>should
>| not return an ArrayCollection or anything at all, really.
>|
>| Dave Watts, CTO, Fig Leaf Software
>| http://www.figleaf.com/
>|
>| Fig Leaf Training: Adobe/Google/Paperthin Certified Partners
>| http://training.figleaf.com/
>|
>| WebManiacs 2008: the ultimate conference for CF/Flex/AIR developers!
>| http://www.webmaniacsconference.com/
>|
>| 

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~|
Adobe® ColdFusion® 8 software 8 is the most important and dramatic release to 
date
Get the Free Trial
http://ad.doubleclick.net/clk;160198600;22374440;w

Archive: http://www.houseoffusion.com/groups/Flex/message.cfm/messageid:5071
Subscription: http://www.houseoffusion.com/groups/Flex/subscribe.cfm
Unsubscribe: 
http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=11502.10531.37

Reply via email to