You need to sign in to do that
Don't have an account?
mtan
Help with VF Page Render Time Improvement
Hi,
One of our user groups is using a custom VF page to consolidate their field work information in a form of a survey.
The problem with the existing VF page they are using is that it takes ages to load the default issue and action information for the option they have selected for a question item.
I am relatively new to Salesforce and was asked to look into and address this performance issue.
Appreciate the help, thanks.
VF Page Code
<apex:page standardController="Checklist_Item__c" extensions="CollectChecklistItemsExtension" sidebar="false"> <apex:form > <apex:pageBlock title="Edit Checklist Item Data" id="idPageBlock1" mode="edit"> <apex:pageMessages /> <apex:pageBlockButtons > <apex:commandButton value="Save" action="{!save}"/> <apex:commandButton value="Cancel" action="{!cancel}"/> </apex:pageBlockButtons> <apex:pageBlockTable value="{!ChecklistItems}" var="c" id="idPageBlockTable1"> <apex:column value="{!c.Id}" rendered="false" /> <apex:column value="{!c.Question_Category__c}" headerValue="Category" /> <apex:column value="{!c.Question__c}" /> <apex:column headerValue="Answer"> <apex:outputPanel id="idAnswerOutputPanel" > <apex:inputField value="{!c.Answer__c}"> <apex:actionSupport event="onchange" rerender="idPageBlock1" status="idStatus"/> </apex:inputField> <apex:actionStatus startText="processing..." id="idStatus"/> </apex:outputPanel> </apex:column> <apex:column headerValue="Comment"> <apex:InputTextArea rows="10" cols="40" value="{!c.Comments__c}" /> </apex:column> <apex:column headerValue="Issue"> <apex:InputTextArea rows="10" cols="40" value="{!c.Issue__c}" rendered="{!c.Answer__c == ''}"/> <apex:InputTextArea rows="10" cols="40" value="{!c.Issue__c}" rendered="{!c.Answer__c == 'Yes'}" /> <apex:InputTextArea rows="10" cols="40" value="{!c.Default_NO_Issue__c}" rendered="{!c.Answer__c == 'No'}" /> <apex:InputTextArea rows="10" cols="40" value="{!c.Default_In_Part_A_Issue__c}" rendered="{!c.Answer__c == 'In-Part A'}" /> <apex:InputTextArea rows="10" cols="40" value="{!c.Default_In_Part_B_Issue__c}" rendered="{!c.Answer__c == 'In-Part B'}" /> <apex:InputTextArea rows="10" cols="40" value="{!c.Default_In_Part_C_Issue__c}" rendered="{!c.Answer__c == 'In-Part C'}" /> <apex:InputTextArea rows="10" cols="40" value="{!c.Issue__c}" rendered="{!c.Answer__c == 'N/A'}" /> </apex:column> <apex:column headerValue="Action"> <apex:InputTextArea rows="10" cols="40" value="{!c.Action__c}" rendered="{!c.Answer__c == ''}" /> <apex:InputTextArea rows="10" cols="40" value="{!c.Action__c}" rendered="{!c.Answer__c == 'Yes'}" /> <apex:InputTextArea rows="10" cols="40" value="{!c.Default_NO_Action__c}" rendered="{!c.Answer__c == 'No'}" /> <apex:InputTextArea rows="10" cols="40" value="{!c.Default_In_Part_A_Action__c}" rendered="{!c.Answer__c == 'In-Part A'}" /> <apex:InputTextArea rows="10" cols="40" value="{!c.Default_In_Part_B_Action__c}" rendered="{!c.Answer__c == 'In-Part B'}" /> <apex:InputTextArea rows="10" cols="40" value="{!c.Default_In_Part_C_Action__c}" rendered="{!c.Answer__c == 'In-Part C'}" /> <apex:InputTextArea rows="10" cols="40" value="{!c.Action__c}" rendered="{!c.Answer__c == 'N/A'}" /> </apex:column> </apex:pageBlockTable> </apex:pageBlock> </apex:form> </apex:page>
Hi mtan,
In the code you specified you are using an standard controller and extension and in the extension
you must be querying the checklist items and mapping it to a list ChecklistItems
which is being displayed in the vf page
instead of querying the checklistitems you can use a attribute called recordsetVar in apex:page
it will contain all the records of the checklist object for you to loop through
this will save a backend operation and the performance can be increased.
hope it helps,
sidz
Hi Sidz,
Thanks for the quick reply. I checked the recordSetVar option you recommended and reading through the VisualForce documentation it seems that it is already being used in the code.
Below refers to that part of the code:
When using the visual page, I noticed that it is taking time when the text "processing..." is displayed but I am not sure how to optimize it.
Any idea? That will be much appreciated. Thanks.
i was referring to using it this way
<apex:page standardController="Check_list__c" recorSetVar="ChecklistItems">
<apex:pageBlockTable value="{!ChecklistItems}" var="c" id="idPageBlockTable1">
</apex:page>
Hi,
the var which you are using in your code is different from recordsetvar. The recordsetvar is attribute of <apex:page> and we generally use it when processing bulk of records,you can get in help. One more thing instead of rerendering the whole pageblock in your action support only rerender the pageblock table this may help.
If you are seeing the "processing..." status message for a long time you should also look into what apex code is being executed during the action that is being processed.
Hi Sidz,
Thanks for the clarification. I was able to modify the code in our sandbox and tried testing the load time again. It doesn't seem to do much difference in terms of the loading time.
I've read somewhere that it is possible to rerender only the row that has been modified instead of the whole page/block but am struggling to implement it in the my code. I tried to look for sample codes but unfortunately can't find any. Would you be able to help?
Thanks, again.
hi mtan,
can you paste your apex code so we can see theif there is any way.
Hi Sidz,
Here are the codes:
Visualforce Page
Apex Class Extension
Update Checklist_Item__c Trigger
Thanks, again.
Hi Sidz,
Sorry to bother you but would just like to check if you had the chance to look into the codes I've sent through and if you have any recommendations as to how else the loading time may be improved.
Many thanks.