I want to assign a list of custom objects to my component controller. If I don't assign it I get the list into the component but as soon as it try to assign the list of objects to the controller it fails:
Cannot convert the value of '{!MyItemList}' to the expected type.
Page:
<apex:page standardController="MyObject__c">
<c:CustomComponent myItemList="{!MyObject__c.MyItems__r}">
</c:CustomComponent>
</apex:page>
Component:
<apex:component controller="CustomComponentController">
<apex:attribute name="myItemList" type="MyItem__c[]" description="" assignTo="{!MyItemList}"/>
</apex:component>
Controller:
public with sharing class CustomComponentController {
public MyItem__c[] MyItemList { get; set; }
}
Why does it fail? How can I pass a list of my objects?