Skip to main content
Tweeted twitter.com/#!/StackSalesforce/status/337705268987179008
Tag added
Link
Sergej Utko
  • 22.1k
  • 11
  • 60
  • 88
Source Link
El Duderino
  • 163
  • 4
  • 14

PageReference within a repeat, that's in a component, action method not being invoked

I attempting to iterate through a list of page indexes to be displayed under a list of returned results. The page indexes are being used for pagination purposes. Whatever page I am currently on displays as a number not highlighted and the others will display as links to that pages results. The problem is that the 's action is not being invoked. This is that particular section of code:

<apex:repeat var="pageIdx" value="{!pageIndexes}" >
  <apex:commandLink rendered="{!pageIdx != pageNumber}"  action="{!onPageChange}"  value="{!pageIdx}">
    <apex:param name="pidx" assignTo="{!pageNumber}" value="{!pageIdx}"/>
   </apex:commandLink>
     <apex:outputText value="{!pageIdx}" rendered="{!pageIdx == pageNumber}"/>&nbsp;
 </apex:repeat>

onPageChange():

public PageReference onPageChange(){
     System.debug(loggingLevel.ERROR, '###### pageNumber: ' + pageNumber);
     MySearchController controller = (MySearchController) pageController;
     controller.getDisplayedRow(pageNumber);
     return null;
}

Even when I change the return statement to return another page, the page is only refreshed nothing is returned. The System.debug statement isn't being reached either. I've tried taking the commandLink out of the repeat and the method works:

<apex:commandLink rendered="{!pageIndexes[1] != pageNumber}" action="{!onPageChange}" value="{!pageIndexes[1]}">
 <apex:param name="pidx" assignTo="{!pageNumber}" value="{!pageIndexes[1]}"/>
 </apex:commandLink>

However I need the repeat to get all of the indexes. Any thoughts?