4

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?

3
  • Is it happening in every browser or only in IE ? Commented May 24, 2013 at 13:21
  • It's happening in multiple browsers. The kicker is, this code is used elsewhere for a different search results page and it works. The only difference here is that I am not using StandardSetControllers to handle pagination and that this code is within a component whereas the other code is in the page directly. Commented May 24, 2013 at 14:07
  • When you returning the new page did you tried setRedirect(true) ? Commented Jul 22, 2013 at 22:05

1 Answer 1

1

In the past I've had issues using apex:param tags within buttons or links unless the reRender attribute is specified. The symptom is usually that the parameter doesn't get passed to the controller which is different than your issue, but might be related. Try adding a reRender attribute to your commandLink and make sure that your refreshing your results and pagination sections.

You must log in to answer this question.

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