• Brad Riley
  • NEWBIE
  • 0 Points
  • Member since 2008

  • Chatter
    Feed
  • 0
    Best Answers
  • 0
    Likes Received
  • 0
    Likes Given
  • 3
    Questions
  • 2
    Replies

Hi all,

Does anyone know a way to cut down the size of the viewstate that gets posted to and from the server?  We are finding very noticeable performance hits when we do AJAX postbacks (or any kind of postback really).  We have done some investigation and have noticed the viewstate is very large for what we are actually rendering to the browser.  For example:

<apex:page>

           <apex:form>

            </apex:form>

</apex:page>

ViewState size = 1772 bytes

<apex:page standardController="Case">

            <apex:form>

                  <table>

                        <tr><th>Head</th></tr>

                        <tr><td>Content</td></tr>

                  </table>

                  <c:TestComponent />

            </apex:form>

            <apex:outputField value="{!Case.Contact.Name}" />

            <apex:outputPanel />

            <apex:outputText value="Test" />

</apex:page>

<apex:component>

      <table>

            <tr><td>Content In Component</td></tr>

      </table>

</apex:component>

ViewState size = 3756 bytes

As you can see these are simple examples that we have slowly built out to monitor the increase in viewstate.  Naturally as our pages get more complex the viewstate gets excessively large, slowing down the round trip to the SF servers.

Therefore, the questions I have are:

Can we configure the viewstate for each component like ASP.Net allows (or for the entire page)?


Cheers

We have overridden the Case detail view so that we can display all the information in a tab format.  On the first tab we are using the <apex:details> element to render the page layout we have defined using the 'drag-and-drop' page layout editor.  However, we notice that all the fields marked as 'Always display' are shown twice!  Once where we have positioned them in the layout, and again at the bottom of the first pageblocksection.
 
Is this a bug? Any ideas?
 
Some example code are:
Visualforce page (which overrides the Case detail view)

 

Code:
<apex:page standardController="Case" extensions="Claim_Detail_Extension" showHeader="true" tabStyle="Case" action="{!init}">
<!-- Define Tab panel .css styles -->
<style>
.contentStyle { font-size:12px; }
.buttonStyle { width:100%; background-color:#B7A752; text-align:center; padding-top:4px; }
.activeTab {background-color: #B7A752; color:white; background-image:none}
.inactiveTab { background-color: #F3F3EC; color:black; background-image:none} 
.NoRecord { font-size:11px;} 
</style>
<apex:sectionHeader title="Claim Details" subtitle="{!Case.CaseNumber}" />
<apex:tabPanel contentClass="contentStyle" tabClass="activeTab" inactiveTabClass="inactiveTab" switchType="client" selectedTab="claimDetails" immediate="false">
<apex:tab label="Details" name="claimDetails" id="claimDetails" style="background-color: #F3F3EC;">
<apex:form >
<div class="buttonStyle">
<apex:outputPanel id="detailButtons">
<apex:commandButton action="{!Edit}" value="Edit" ></apex:commandButton>
<apex:commandButton action="{!SearchCRIS}" value="Search CRIS" rendered="{!RenderSearchCRIS}" ></apex:commandButton>
<apex:commandButton action="{!CloneClaim}" value="Clone" rendered="{!RenderCloneClaim}" ></apex:commandButton>
<apex:commandButton action="{!NextStatus}" value="Notify" rendered="{!RenderNotify}" immediate="true" rerender="detailButtons, detail, OpenActivities"> 
</apex:commandButton>
<apex:commandButton action="{!NextStatus}" value="Admit" rerender="detailButtons, detail" immediate="true" rendered="{!RenderAdmit}" ></apex:commandButton>
<apex:commandButton action="{!CloseClaim}" value="{!CloseButtonText}" rendered="{!RenderCloseClaim}" ></apex:commandButton>
<apex:commandButton action="{!PrintDocument}" value="Create Letter" />
</apex:outputPanel>
</div> 
</apex:form> 
<apex:outputPanel id="detail">
<apex:detail relatedList="false" relatedListHover="false" subject="{!Case.Id}" title="false" />
</apex:outputPanel>
</apex:tab>
</apex:tabPanel>
</apex:page>

This results is all the required fields being displayed twice in the <apex:details> block.

 

Cheers



Message Edited by Brad Riley on 08-05-2008 09:02 PM
Does anyone know how to set the Tab Order for a PageBlockSection?  I want it to be up to down, but it seems to default to left to right.

Hi all,

Does anyone know a way to cut down the size of the viewstate that gets posted to and from the server?  We are finding very noticeable performance hits when we do AJAX postbacks (or any kind of postback really).  We have done some investigation and have noticed the viewstate is very large for what we are actually rendering to the browser.  For example:

<apex:page>

           <apex:form>

            </apex:form>

</apex:page>

ViewState size = 1772 bytes

<apex:page standardController="Case">

            <apex:form>

                  <table>

                        <tr><th>Head</th></tr>

                        <tr><td>Content</td></tr>

                  </table>

                  <c:TestComponent />

            </apex:form>

            <apex:outputField value="{!Case.Contact.Name}" />

            <apex:outputPanel />

            <apex:outputText value="Test" />

</apex:page>

<apex:component>

      <table>

            <tr><td>Content In Component</td></tr>

      </table>

</apex:component>

ViewState size = 3756 bytes

As you can see these are simple examples that we have slowly built out to monitor the increase in viewstate.  Naturally as our pages get more complex the viewstate gets excessively large, slowing down the round trip to the SF servers.

Therefore, the questions I have are:

Can we configure the viewstate for each component like ASP.Net allows (or for the entire page)?


Cheers

I login to salesforce.com developer, click Setup, Build, Code and then click Generate from WSDL.  I browse to our wsdl and then get an error.
 
The error I get is "Error: Failed to parse wsdl: Unknown element: import."  Does Apex support .Net 3.0 WCF services?
 
Ryan
  • January 18, 2008
  • Like
  • 0