You need to sign in to do that
Don't have an account?
JJames
Having issues with Apex:Repeat on lists
Not sure why this isn't working, but is it not enough to have get;set; on a list of objects as a getter to use them in a repeat function with a visualforce page?
public List<Custom_Quote_Item__c> quoteItemList {get;set;}
then in the visualforce page:
<apex:repeat value="{!quoteItemList}" var="qi">
I know the list has about 10 items in it but nothing is executing inside the repeat.
I also tried creating a getter function:
public List<Custom_Quote_Item__c> getQuoteItems() {
return quoteItemList;
}
but that isn't working either. I am confused why this isn't working because i am using repeat on a number of lists in my class which all seem to work find but this one isn't. If anyone has any input I would greatly appreciate it!
Thanks
public List<Custom_Quote_Item__c> quoteItemList {get;set;}
then in the visualforce page:
<apex:repeat value="{!quoteItemList}" var="qi">
I know the list has about 10 items in it but nothing is executing inside the repeat.
I also tried creating a getter function:
public List<Custom_Quote_Item__c> getQuoteItems() {
return quoteItemList;
}
but that isn't working either. I am confused why this isn't working because i am using repeat on a number of lists in my class which all seem to work find but this one isn't. If anyone has any input I would greatly appreciate it!
Thanks
If you use
public List<Custom_Quote_Item__c> quoteItemList {get;set;}
then you have to populate quoteItemList in the constructor of the controller. Are you doing that?
Normally it's a best practice to use full getter pattern without a constructor like
public List<Custom_Quote_Item__c> quoteItemList {
get{
if(quoteItemList == null){
// populate the first time
quoteItemList = [select id, name from Custom_Quote_Item__c];
}
return quoteItemList;
}
set;
}
Also on the VF page you can put this in there as a debug to see the size of the list. I've never seen a repeat fail before.
size: {!quoteItemList.size}