function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion
BoolsEyeBoolsEye 

Partial page update in apex:tabpanel not working ?

In my sample code the partial page update on one tab is not working.
 
Can someone help me out if I understand the concept behind partial page updates right ?
 
I have a pageBlockTable on Tab1 with Contacts and a second page pageBlockTable on Tab2 with Accounts
 
If I click the commandButton on Tab1 the Contacts should be rerendered.
 
It works, but when I check the debug log, the query for the Accounts is also run. Not only once, but twice. Why ?
 
>>Class.myController.getContacts: line 5, column 16: [select Name from Contact LIMIT 10]: executed 2 times in 11 ms<<
>>Class.myController.getAccounts: line 13, column 16: [select Name from Account LIMIT 10]: executed 2 times in 11 ms<<
I tried everything with actionRegion, outputPanel etc. but nothing helps.
 
What do I have to change that only the query for Contacts on Tab1 is run ? Is this possible ?
 
Code:
<apex:page controller="myController">
<apex:tabpanel switchtype="client">
 <apex:tab label="Tab2">
  <apex:form >
  <apex:pageBlock > 
   <apex:pageblockButtons >
    <apex:actionRegion >
     <apex:commandButton action="{!doSomething}" value="Go!" status="testStatus" rerender="out"/>
    </apex:actionRegion>
   </apex:pageblockButtons>
   <apex:outputpanel id="out">
    <apex:actionStatus id="testStatus" startText="Requesting...">
    <apex:facet name="start">
     Requesting...  
    </apex:facet>
    <apex:facet name="stop">
     <apex:pageBlockTable id="blockContacts" value="{!Contacts}" var="con">
      <apex:column value="{!con.Name}"/>
     </apex:pageBlockTable>
    </apex:facet>
   </apex:actionStatus>
   </apex:outputPanel>
  </apex:pageBlock>
  </apex:form>
 </apex:tab>
 <apex:tab label="Tab2">
  <apex:pageBlock >
   <apex:pageBlockTable value="{!Accounts}" var="acc">
    <apex:column value="{!acc.Name}"/>
  </apex:pageBlockTable>
  </apex:pageBlock>
 </apex:tab>
</apex:tabpanel>
</apex:page>

 
Code:
public class myController {
 
 
 public List<Contact> getContacts() {
  return [select Name from Contact LIMIT 10];
 }
 
 public PageReference doSomething() {
  return null;
 }

 public List<Account> getAccounts() {
  return [select Name from Account LIMIT 10];
 }
 
}

 
Code:
00:12:02 DEBUG - 
***Begining Page Log for /apexpages/devmode/developerModeContainer.apexp
20081009221203.062:External entry point:     returning LIST:SOBJECT:Contact from method public LIST:SOBJECT:Contact getContacts() in 0 ms
20081009221203.062:Class.myController.getContacts: line 5, column 16: SOQL query with 10 rows finished in 7 ms
20081009221203.062:External entry point:     returning LIST:SOBJECT:Account from method public LIST:SOBJECT:Account getAccounts() in 0 ms
20081009221203.062:Class.myController.getAccounts: line 13, column 16: SOQL query with 10 rows finished in 6 ms
20081009221203.062:External entry point:     returning NULL from method public System.PageReference doSomething() in 0 ms
Element j_id7 called method {!doSomething} returned type PageReference: none20081009221203.062:External entry point:     returning LIST:SOBJECT:Contact from method public LIST:SOBJECT:Contact getContacts() in 0 ms
20081009221203.062:Class.myController.getContacts: line 5, column 16: SOQL query with 10 rows finished in 4 ms
20081009221203.062:External entry point:     returning LIST:SOBJECT:Account from method public LIST:SOBJECT:Account getAccounts() in 0 ms
20081009221203.062:Class.myController.getAccounts: line 13, column 16: SOQL query with 10 rows finished in 5 ms
Cumulative profiling information:2 most expensive SOQL operations:
Class.myController.getContacts: line 5, column 16: [select Name from Contact LIMIT 10]: executed 2 times in 11 ms
Class.myController.getAccounts: line 13, column 16: [select Name from Account LIMIT 10]: executed 2 times in 11 ms
No profiling information for SOSL operations.
No profiling information for DML operations.3 most expensive method invocations:
Class.myController: line 4, column 26: public LIST:SOBJECT:Contact getContacts(): executed 2 times in 11 ms
Class.myController: line 12, column 26: public LIST:SOBJECT:Account getAccounts(): executed 2 times in 11 ms
Class.myController: line 8, column 26: public System.PageReference doSomething(): executed 1 time in 0 ms
***Ending Page Log for /apex/Candidates—core.apexpages.devmode.url=1&save_new=1

 


Message Edited by BoolsEye on 10-10-2008 12:35 AM
devlydevdevlydev

Hey,

 

Did you ever find a solution for this issue?