4

I know that there is a similar question from a while ago but...

I have a component that is not rerendering

<apex:actionFunction status="waiting" name="refreshTable" action="{!refresh}" rerender="learnComnt" oncomplete="reloadTable();"/>
<div> 
    <c:Learning_Reviews_Component id="learnComnt" assignmentid="{!AssignmentID}" li="{!learningItemID}" type="{!LIType}"/> 
</div>

This component is used to display reviews in a few places. It is shown on a description page on which is a button to create a new review.

<apex:commandButton id="Review" value="Rate it!" onclick="openedWindow = openRateWindow('{!$Page.Review}?type={!LIType}&Lid={!learningItemID}');" title="Submit a Review" />

the javascript in the description page:

function openRateWindow(link) {
    window.open(link, "_blank","fullscreen=no, scrollbars=no, resizable=no, titlebar=no, status=no, height=650, width=800, top=100, left=100");
}

On the review page is a javascript function that is called when the save button processes.

function MyCloseWindow() {
        var status = document.getElementById('{!$Component.pg.createReview.pb.pbs.statusMsg}');
        if(status.value == "Saved"){
            window.opener.refreshTable();
            window.close();
            self.close();
        }

So - the page opens, saves and closes as expected but

  1. When the review page is opened, the URL on the description page is altered (do not know how) and drops the last two items in the query string (apex/Details?id=000000000000000&type=Module&asnmt=000000000000000000) turns to (apex/Details?id=000000000000000)
  2. When the page refreshes, the component empties
  3. If I replace the rerender on the actionFunction to bufferTableResult (name of the outputPanel in the component) then the old results double up so I get 2 lists of data that do not include the new review.

Any ideas as to what I am doing wrong??

EDIT: I wrapped the component call in an actionRegion and it made no discernible difference. When I rerender the actionRegion there is no change to the behaviour.

<apex:actionRegion id="actioRegion">
    <apex:outputPanel layout="block" id="componentPanel"> 
        <c:Learning_Reviews_Component id="learnComnt" assignmentid="{!AssignmentID}" li="{!learningItemID}" type="{!LIType}"/>
    </apex:outputPanel>
</apex:actionRegion>

new version below

<apex:actionFunction status="waiting" name="refreshTable" action="{!refresh}" oncomplete="reloadTable();" rerender="actioRegion"/>

Rerendering on anything other than bufferTableResult causes no results to display. Rerendering on bufferTableResult causes a duplication effect with all of the previous reviews in list form... (review 1,2,3,4 followed by review 1,2,3,4)

I also checked the debug logs and the messages in the controller of the component are not showing

4
  • Did you try to wrap a it in a <apex:actionRegion> ?
    – David Renz
    Aug 12 '14 at 10:05
  • Wrap which element in actionRegion?
    – SeanGorman
    Aug 12 '14 at 13:15
  • Your whole component.
    – David Renz
    Aug 12 '14 at 13:43
  • I wrapped the component call and it made not discernible difference. Also, when I rerender the actionRegion there is no change.
    – SeanGorman
    Aug 12 '14 at 16:04
2

Try doing this:

<apex:actionFunction status="waiting" name="refreshTable" action="{!refresh}" rerender="componentPanel" oncomplete="reloadTable();"/>
<apex:outputPanel layout="block" id="componentPanel"> 
    <c:Learning_Reviews_Component id="learnComnt" assignmentid="{!AssignmentID}" li="{!learningItemID}" type="{!LIType}"/> 
</apex:outputPanel>

Instead of rendering the component try rendering the panel and component inside panel will automatically rerender.

Hope this will help.

1
  • This doesn't work - but I think it might be more to do with the fact that the URL is getting shortened somehow.
    – SeanGorman
    Aug 12 '14 at 2:40

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.