7

I'm stuck on a reRender issue.

I have a commandButton element which calls an action function, which should reRender a pageBlock on return and then trigger an oncomplete event.

Action button in pageBlock:

<apex:pageBlock mode="detail" id="group_block">
    <!-- other code -->
    <apex:commandButton id="apply_button" value="Apply Filters" action="{!applyFilters}"  reRender="group_block" oncomplete="setup();" />
</apex:pageBlock>

public PageReference applyFilters() {
    buildDataStructures(total, DELETE_DEALERS_WITH_NO_PACKAGES);

    return null;
}

If I remove the reRender attribute then I get the functionality that I want (data structures rebuilt in the controller according to certain filters, the pageBlock is rebuilt on page refresh, and the setup() javascript function runs onready). However, I would muh prefer to only refresh the pageBlock on reRender rather than refresh the whole page.

I had this working yeaterday but I changed some (mainly markup!) code and for some reson this is no longer functioning.

I can confirm that the action function in the controller is being called, yet there is a line in the debug logs that shows:

VF_APEX_CALL|apply_button|{!applyFilters}|PageReference: none

I'm not 100% sure what this means, but I would expect it to show null there rather than none. Is this significant?

I'm not sure how I can debug this. I'm not getting any javascript errors showing in the console. I just need to find out when the controller isn't returning.

I have also tried wrapping the pageBlock in an outputPanel.

Grateful for any suggestions. Thanks

  • 3
    I have had some troubles with rerender not working on pageBlocks, try wrapping your entire pageBlock in a apex:outputPanel and rerender the outputpanel – pjcarly May 16 '13 at 11:39
  • Hi PJC. I noted in my post that I have tried that. – Joe May 16 '13 at 13:04
  • 2
    Does a parent of the pageBlock have a rendered attribute so that it doesnt render when the page first loads. It isnt possible to reRender what didnt render, worth checking if that's the case. – techtrekker May 16 '13 at 13:10
  • 1
    This shouldn't be happening. Are you sure that the block you want to rerender is within the outer page block? Also, is there something related to rendering happening in setup()? – Adam May 16 '13 at 15:12
  • Have you tried rerender with a lower case r? I know the docs show it as reRender and I don't know if it makes a difference but I always write it lowercase. – Matt Lacey May 17 '13 at 2:34
2

Depending on what you have in your <!-- other code --> section, you might be sending some other value at the same time, preventing your request to be done completely. This might be a validation rule issue or something else (if you have a validation rule preventing a DML request). They do not always show up on the UI (especially if you don't have an <apex:pageMessages/> block to display them.

Make sure you dig in your debug console, or try removing some of your other code until you find what is breaking your call. If you share some of your code, it might be easier to troubleshoot.

0

Try wrapping your commandButton in an actionRegion tag

 <apex:actionRegion>
     <apex:commandButton ..../>
 </apex:actionRegion>

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.