+ Start a Discussion
PerGeertPerGeert 

Rerender rerender part of page but then whole page is refeshed

Im using a controller extension to account for this page. However, what happens when you click Go! is that first the list of accounts is rerendered and after a second or so, the hole page is refreshed.
In the real program that wipes out data created in other sections by JS.
I would expect only the portion mentioned in the rerender to be refreshed.
 
Looks like onclick event is the culprit. Changing the page so that the rerender is triggered onchange on the select list, works as expected. Still, I want my onclick for other purposes
 
Any ideas?
 
 
 

<apex:page standardController="Account" recordSetvar="accounts"

extensions="Account2MapControllerExt">

<script src="http://maps.google.com/maps?file=api&v=2.x&key={!mapkey}" type="text/javascript"></script>

<script src="http://www.google.com/jsapi?key={!mapkey}" type="text/javascript" ></script>

<apex:form >

<apex:pageBlock >

  <apex:pageBlockSection title="Select Account List" columns="1" collapsible="false">

    <apex:outputPanel > Select an account list view to map :

      <apex:selectList value="{!filterId}" size="1">

        <apex:selectOptions value="{!listviewoptions}" />

        </apex:selectList>

      <apex:commandButton value="Go!" >

      <apex:actionSupport event="onclick" reRender="accTable" status="accStatus" />

      </apex:commandButton>

      <apex:actionStatus id="accStatus" startText="(incrementing...)" stopText="(done)"/>

    </apex:outputPanel>

  </apex:pageBlockSection>

  <apex:pageBlockSection >

    <apex:dataTable value="{!accounts}" var="a" id="accTable" rows="3">

      <apex:column value="{!a.id}" rendered="false"/>

      <apex:column value="{!a.name}" rendered="true"/>

    </apex:dataTable>

  </apex:pageBlockSection>

</apex:pageBlock>

</apex:form>

</apex:page>



Message Edited by PerGeert on 11-22-2008 06:19 PM

Message Edited by PerGeert on 11-22-2008 07:50 PM
harlequinharlequin

I think you'll find that the 'actionSupport' tag is rerendering the list, then the commandButton is refreshing the page (both asking for the same data), so if you move the rerender and status bits from the actionSupport tag into the commandButton tag, then remove the actionSupport tag, it should work ok.

Code:
<apex:commandButton value="Go!" rerender="accTable" status="accStatus" />     
<apex:actionStatus id="accStatus" startText="(incrementing...)" stopText="(done)"/> 


 

PerGeertPerGeert
Thanks, that was the problem.