• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 624
  • Last Modified:

duplicate item to a flex datagrid

How do I duplicate a item in a Datagrid? I have a custom class (someClass) for the item of ItemList. The way is coded below the new item that shows up is in fact the SAME item selected, instead of a NEW item. I don't know how to clone the items of the list, can anyone please help me?

	<fx:Script>
		<![CDATA[
			protected function Duplicar_Item_clickHandler(event:MouseEvent):void
			{
				var tarVo:someClass= new someClass();
				tarVo = productGrid.dataProvider.getItemAt(productGrid.selectedIndex);	
				productGrid.dataProvider.addItemAt(tarVo,productGrid.selectedIndex);	
			}
			
		]]>

		<s:Button label= "Duplicate Item"
				  click="Duplicar_Item_clickHandler(event)"
				  enabled="{productGrid.selectedIndex != -1}"/>

	<mx:DataGrid id="productGrid" dataProvider="{ItemList}" 
				 editable="true" dragEnabled="true" dragMoveEnabled="true" 
				 dropEnabled="true" horizontalScrollPolicy="{ScrollPolicy.AUTO}"
				 width="100%"
				 height="100%"  />

Open in new window

0
C_Schlottfeldt
Asked:
C_Schlottfeldt
1 Solution
 
C_SchlottfeldtAuthor Commented:
THanks !!
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

Join & Write a Comment

Featured Post

Free Tool: ZipGrep

ZipGrep is a utility that can list and search zip (.war, .ear, .jar, etc) archives for text patterns, without the need to extract the archive's contents.

One of a set of tools we're offering as a way to say thank you for being a part of the community.

Tackle projects and never again get stuck behind a technical roadblock.
Join Now