Spring'14 (bug?) with apex:repeat and sets
I don't think this is a new behaviour in Spring 14.
In the discussion forums - Table rows repeating for each Child Record present in Parent to Child Query there is a comment from @bob-buzzard in 2011:
It seems to be a problem when the set contains sobjects - I've just checked back on mine and they've been primitives. It smacks that the "SetValue" in the page (sounds low-level possibly a java class) can convert to a string for display if its a primitive, but not when a complex object.
There is an example of using a primitive Set
with an apex:repeat in the answer Peter Knolle provided to another question.
As an alternative to using a Set
you could instead use a Map
(assuming your records have been inserted and have an Id). Then use the syntax from Referencing Apex Maps and Lists to drive the repeat over the maps keys and lookup the corresponding value.
Controller:
public class CreateOrders {
public Map<Id, Item__c> selectedItems {get; set;}
public CreateOrders() {
selectedItems = new Map<Id, Item__c>();
for (Item__c i : findItems()) {
selectedItems.put(i.Id, i);
}
}
}
Visualforce page:
<apex:repeat value="{!selectedItems}" var="itm">
<apex:outputfield value="{!selectedItems[itm].Name}" />
</apex:repeat>
I will try to confirm this but I think tis is caused because set is non-ordered collection of data and you just can't get element number [i] and ask it for values like repeat block try to do - and thats why it work with list
For now lets be patient and wait for one of MVP to speak :)