How to delete an item from item renderer in Spark List Flex/AIR?

	
<s:ItemRenderer>
	<fx:Script>
		<![CDATA[
			import spark.components.List;
			
			public function deleteItem():void 
			{
				var parentList:List = owner as List;
				
				parentList.dataProvider.removeItemAt(parentList.dataProvider.getItemIndex(data))
			}
		]]>
	</fx:Script>
	<s:HGroup>
		<s:Label text="{data}" />
		<s:Button id="remove" label="X" click="deleteItem()"/>
	</s:HGroup>
</s:ItemRenderer>
Advertisements

One thought on “How to delete an item from item renderer in Spark List Flex/AIR?

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s