+ Start a Discussion
LindaKatLindaKat 

Standard List Controller Pagination not showing

I completed the entire samples on ContactList.vsp as directed, and with no Problems but after Saving it many times, the Pagination does not show on preview.  Please let me know if you see any errors.  All the code snippets were copied from the Trailhead Module.  Here's the code:

<apex:page standardController="Contact" recordSetVar="contacts">
    <apex:form >
        <apex:pageBlock title="Contacts List" id="contacts_list">
            
            Filter: 
                <apex:selectList value="{! filterId }" size="1">
                 <apex:selectOptions value="{! listViewOptions }"/>
                <apex:actionSupport event="onchange" reRender="contacts_list"/>
                </apex:selectList>
            
            <!-- Contacts List -->
            <apex:pageBlockTable value="{! contacts }" var="ct">
<!-- Pagination -->
<table style="width: 100%"><tr>

    <td>
Page: <apex:outputText value=" {!PageNumber} of {! CEILING(ResultSize / PageSize) }"/>    </td>            

    <td align="center">
<!-- Previous page -->
<!-- active -->
<apex:commandLink action="{! Previous }" value="« Previous"
     rendered="{! HasPrevious }"/>
<!-- inactive (no earlier pages) -->
<apex:outputText style="color: #ccc;" value="« Previous"
     rendered="{! NOT(HasPrevious) }"/>

&nbsp;&nbsp;  

<!-- Next page -->
<!-- active -->
<apex:commandLink action="{! Next }" value="Next »"
     rendered="{! HasNext }"/>
<!-- inactive (no more pages) -->
<apex:outputText style="color: #ccc;" value="Next »"
     rendered="{! NOT(HasNext) }"/>
    </td>
    
    <td align="right">
Records per page:
<apex:selectList value="{! PageSize }" size="1">
    <apex:selectOption itemValue="5" itemLabel="5"/>
    <apex:selectOption itemValue="20" itemLabel="20"/>
    <apex:actionSupport event="onchange" reRender="contacts_list"/>
</apex:selectList>
    </td>

</tr></table>

                <apex:column value="{! ct.FirstName }"/>
                <apex:column value="{! ct.LastName }"/>
                <apex:column value="{! ct.Email }"/>
                <apex:column value="{! ct.Account.Name }"/>
            </apex:pageBlockTable>
         
        </apex:pageBlock>
     </apex:form>
</apex:page>
Best Answer chosen by LindaKat
Swayam@SalesforceGuySwayam@SalesforceGuy
Hi,

There is problem with the code, you need to put HTML tabele out the pageblock table, 

Updated Code :-
 
<apex:page standardController="Contact" recordSetVar="contacts">
    <apex:form >
        <apex:pageBlock title="Contacts List" id="contacts_list">
            
            Filter: 
                <apex:selectList value="{! filterId }" size="1">
                 <apex:selectOptions value="{! listViewOptions }"/>
                <apex:actionSupport event="onchange" reRender="contacts_list"/>
                </apex:selectList>
            
            <!-- Contacts List -->
            <apex:pageBlockTable value="{! contacts }" var="ct">

                <apex:column value="{! ct.FirstName }"/>
                <apex:column value="{! ct.LastName }"/>
                <apex:column value="{! ct.Email }"/>
                <apex:column value="{! ct.Account.Name }"/>
            </apex:pageBlockTable>
         <!-- Pagination -->
<table style="width: 100%"><tr>

    <td>
Page: <apex:outputText value=" {!PageNumber} of {! CEILING(ResultSize / PageSize) }"/>    </td>            

    <td align="center">
<!-- Previous page -->
<!-- active -->
<apex:commandLink action="{! Previous }" value="« Previous"
     rendered="{! HasPrevious }"/>
<!-- inactive (no earlier pages) -->
<apex:outputText style="color: #ccc;" value="« Previous"
     rendered="{! NOT(HasPrevious) }"/>

&nbsp;&nbsp;  

<!-- Next page -->
<!-- active -->
<apex:commandLink action="{! Next }" value="Next »"
     rendered="{! HasNext }"/>
<!-- inactive (no more pages) -->
<apex:outputText style="color: #ccc;" value="Next »"
     rendered="{! NOT(HasNext) }"/>
    </td>
    
    <td align="right">
Records per page:
<apex:selectList value="{! PageSize }" size="1">
    <apex:selectOption itemValue="5" itemLabel="5"/>
    <apex:selectOption itemValue="20" itemLabel="10"/>
    <apex:actionSupport event="onchange" reRender="contacts_list"/>
</apex:selectList>
    </td>

</tr></table>

        </apex:pageBlock>
     </apex:form>
</apex:page>

Hope this helps,

--
Thanks,
Swayam

All Answers

Swayam@SalesforceGuySwayam@SalesforceGuy
Hi,

There is problem with the code, you need to put HTML tabele out the pageblock table, 

Updated Code :-
 
<apex:page standardController="Contact" recordSetVar="contacts">
    <apex:form >
        <apex:pageBlock title="Contacts List" id="contacts_list">
            
            Filter: 
                <apex:selectList value="{! filterId }" size="1">
                 <apex:selectOptions value="{! listViewOptions }"/>
                <apex:actionSupport event="onchange" reRender="contacts_list"/>
                </apex:selectList>
            
            <!-- Contacts List -->
            <apex:pageBlockTable value="{! contacts }" var="ct">

                <apex:column value="{! ct.FirstName }"/>
                <apex:column value="{! ct.LastName }"/>
                <apex:column value="{! ct.Email }"/>
                <apex:column value="{! ct.Account.Name }"/>
            </apex:pageBlockTable>
         <!-- Pagination -->
<table style="width: 100%"><tr>

    <td>
Page: <apex:outputText value=" {!PageNumber} of {! CEILING(ResultSize / PageSize) }"/>    </td>            

    <td align="center">
<!-- Previous page -->
<!-- active -->
<apex:commandLink action="{! Previous }" value="« Previous"
     rendered="{! HasPrevious }"/>
<!-- inactive (no earlier pages) -->
<apex:outputText style="color: #ccc;" value="« Previous"
     rendered="{! NOT(HasPrevious) }"/>

&nbsp;&nbsp;  

<!-- Next page -->
<!-- active -->
<apex:commandLink action="{! Next }" value="Next »"
     rendered="{! HasNext }"/>
<!-- inactive (no more pages) -->
<apex:outputText style="color: #ccc;" value="Next »"
     rendered="{! NOT(HasNext) }"/>
    </td>
    
    <td align="right">
Records per page:
<apex:selectList value="{! PageSize }" size="1">
    <apex:selectOption itemValue="5" itemLabel="5"/>
    <apex:selectOption itemValue="20" itemLabel="10"/>
    <apex:actionSupport event="onchange" reRender="contacts_list"/>
</apex:selectList>
    </td>

</tr></table>

        </apex:pageBlock>
     </apex:form>
</apex:page>

Hope this helps,

--
Thanks,
Swayam
This was selected as the best answer
LindaKatLindaKat
That’s perfect!  Thanks.  I thought I had tried that, but I guess I didn’t.  the directions in the module were not easy to understand.
Swayam@SalesforceGuySwayam@SalesforceGuy
Hi,

Can you please mart it solved.  So that other can refer it.


--
Thanks,
Swayam
LindaKatLindaKat
I don't see where to mark it solved.
Swayam@SalesforceGuySwayam@SalesforceGuy
Thanks