Salesforce-Platform-Developer-II Practice Test
202 Questions
Refer to the exhibit:
Users of this Visualforce page complain that the page does a full refresh every time the
Search button Is pressed.
What should the developer do to ensure that a partial refresh Is made so that only the
section identified with opportunity List is re-drawn on the screen?
A. Enclose the DATA table within the
B. Implement the render attribute on the
C. Ensure the action method search returns null.
D. Implement the
Explanation:
To address the issue of the Visualforce page performing a full refresh every time the Search button is pressed, the goal is to enable a partial refresh, updating only the section identified as opportunityList (the
Understanding the Problem
The Visualforce page includes an
Evaluating the Options
A. Enclose the DATA table within the
➜ What it does: The
➜ Impact: Wrapping the
➜ Verdict: This alone doesn’t solve the partial refresh issue.
B. Implement the render attribute on the
➜ What it does: The rerender attribute (likely a typo in the option as "render") on
➜ Impact: When the Search button is clicked, the search action method runs, and only the component with id="opportunityList" (the
➜ Verdict: This directly addresses the requirement for a partial refresh.
C. Ensure the action method search returns null
➜ What it does: In Visualforce, an action method that returns null keeps the user on the same page after the action completes, rather than navigating to a new page. For example:
apexpublic PageReference search() {
// Logic to populate opportunityList
return null;
}
➜ Impact: Returning null prevents navigation but doesn’t inherently trigger a partial refresh. Without a rerender attribute on the
➜ Verdict: This doesn’t ensure a partial refresh by itself.
D. Implement the apex:commandbutton tag with immediate=true
➜ What it does: The immediate=true attribute on apex:commandbutton skips validation and field update phases, processing the action immediately. For example:
xml apex:commandbutton value="Search" action="{!search}" immediate="true"
➜ Impact: This bypasses input validation and updates, which might be useful in some cases, but it doesn’t control the rendering process. Without a rerender attribute, the button still causes a full page refresh. The immediate attribute is unrelated to partial page updates.
➜ Verdict: This doesn’t achieve the desired partial refresh.
Conclusion:
The key to a partial refresh in Visualforce is using the rerender attribute on the apex:commandbutton to specify the id of the section to update (in this case, opportunityList). This leverages AJAX to refresh only the
Thus, the developer should:
B. Implement the render attribute on the apex:commandButton tag
Salesforce-Platform-Developer-II Practice-Test - Home | Previous |
Page 4 out of 202 Pages |