function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion
kora bornkora born 

contact list pagination from trailhead not working

Hi, I am following the List controller trailhead, but the progress bar doesnt work the way it is supposed to. I reduced the no. of records pp to 5 and it still didnt activate the buttons nor page # - I followed the trail step by step; what could I be missing ? Thanks !

User-added image


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>
            
        </apex:pageBlock>
        <!-- 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:form>
</apex:page>
Best Answer chosen by kora born
Saurabh TyagiSaurabh Tyagi
Hi kora,
Your code seems to work fine, try to refresh your developer console and see if it helps.


User-added image

User-added image
Regards
Saurabh
 

All Answers

Saurabh TyagiSaurabh Tyagi
Hi kora,
Your code seems to work fine, try to refresh your developer console and see if it helps.


User-added image

User-added image
Regards
Saurabh
 
This was selected as the best answer
kora bornkora born
My comment seems to have vanished into thin air ! I had mentioned seems like the console needs constant ws switching and resets and browser restarst..