I know this is a bit late, but I ran into a similar issue:
<apex:page controller="Con_ShowEmSchweetly">
<apex:repeat value="{!myIdSet}" var="myId">
<c:mySchweetComponent relatedId="{!myId}"/>
</apex:repeat>
</apex:page>
with my controller
public class Con_ShowEmSchweetly{
public set<id> myIdSet {get;set;}
public Con_ShowEmSchweetly(){
this.myIdSet=new set<id>();
for(Project__c p:[SELECT id FROM Project__c])
myIdSet.add(p.id);
}
}
I was getting this error:
Error: Wrong type for attribute <c:mySchweetComponent projectId="{!pId}">
.
Expected id, found SetValue
The solution is to change myIdSet
to a list<id>
.
Sample Component
Component Controller
public class Con_mySchweetComponent{
public id projId {get;set;}
public list<Project_Item__c> projectItemList {get;set;}
public Con_mySchweetComponent(){
this.projectItemList=new list<Project_Item__c>();
}// NOTE: a component doesn't initialize variables, the component sets them after the controller is initialized
public Project__c getProject(){
if(projId==null)
return new Project___c();
// in this example, calling getProject() will initialize this.projectItemList
this.projectItemList=[SELECT id,Name,Description__c
FROM Project_Item__c
WHERE Project__c =:projId];
return [SELECT id,Name
FROM Project__c
WHERE id =:projId];
}
}//END Con_mySchweetComponent
Visualforce Component
<apex:component controller="Con_mySchweetComponent">
<apex:attribute name="projectId" assignTo="{!projId}"
type="id" required="true"
description="Id for which Project to display"/>
<head>
<style>
.displayNone{
display:none;
}
.controllerCol-1{
width:75%;
}
.controllerCol-2{
width:25%;
}
</style>
</head>
<apex:pageBlock title="{!Project.Name}">
<apex:pageBlockSection columns="2" title="Visualforce Pages">
<apex:pageBlockTable value="{!ProjectItemList}" var="projectItem" columnClasses="controllerCol-1,controllerCol-2">
<apex:column headerValue="Page"><apex:outputLink value="{!projectItem.id}">{!projectItem.Name}</apex:outputLink></apex:column>
<apex:column headerValue="Description" value="{!projectItem.Description__c}"/>
</apex:pageBlockTable>
</apex:pageBlockSection>
</apex:pageBlock>
</apex:component>
List<String> stringList = new List<String>(stringSet);