Flex - Using IDropInListItemRenderer

Tags: , , ,

When you're within an item renderer where you want to know more about it's parent list, or underlying collection, IDropInListItemRenderer can be invaluable to you.  Once implemented, a BaseListData object is automatically passed into any item renderer that implements it.   From BaseListData a lot of things are available.  The following code shows a lot of things you can access from it.  For a more in depth description, check out the language reference BaseListData.

public function set listData(value:BaseListData):void
		{
 
			if(!value)return;
 
			var lb:ListBase = (_value.owner as ListBase);
			var collection:ListCollectionView = (lb.dataProvider as ListCollectionView)
			var total:Number = collection.length;
			var index:Number = lb.itemRendererToIndex(this as IListItemRenderer);
		}

If you have any comments or questions leave them below