1

I'm having an issue where my visual force page is not showing any data. The SOQL query tool clearly shows data entered in the database, but the visual force table is not populated.

Here is my controller

public class retrieveDivision {
    public ApexPages.StandardSetController setCon {
        get {
            if(setCon == null) {
                setCon = new ApexPages.StandardSetController(Database.getQueryLocator(
                    [SELECT Name, Percent_Spent__c FROM Division__c]));
            }
            return setCon;
        }
        set;
    }
    public List<Division__c> getDivisions() {
        return (List<Division__c>) setCon.getRecords();
    }
}

And my visual force page.

<apex:page controller="retrieveDivision">
    <apex:pageBlock rendered="True" title="Divisions"  >
        <apex:pageBlockTable value="{!divisions}" var="div">
            <column hadervalue="Name" value="{!div.Name}"/>
            <column value="{!div.Percent_Spent__c}"/>
        </apex:pageBlockTable>
    </apex:pageBlock>
</apex:page>

The resulting table as it appears in my dashboard:

enter image description here

2 Answers 2

1

You have written:

<column hadervalue="Name" value="{!div.Name}"/>
<column value="{!div.Percent_Spent__c}"/>

which looks like it doesn't render in the browser (though is valid XML so doesn't cause an error because Visualforce allows you to include non-Visualforce tags) rather than using the required Visualforce apex:column component:

<apex:column headervalue="Name" value="{!div.Name}"/>
<apex:column value="{!div.Percent_Spent__c}"/>
2
  • Thanks, this was a really obvious and silly mistake on my part!
    – JSF
    Jul 17, 2014 at 13:33
  • @user10465 Not that obvious - I started at the controller first too thinking the problem was there.
    – Keith C
    Jul 17, 2014 at 13:34
0

Try defining a variable called divisions in your controller. My thoughts are that the page is trying to find a variable that doesn't exist, and is understanding your get method for divisions as a function, not a getter.

If that doesn't work, I would recommend to create a list of test data, and see if the page will accept that data, to tell if its the controller, or the page. If its the controller, my bet would be that you need to alter how you are calling your query to something less complex.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .