Activity › Forums › Salesforce® Discussions › How can you create partial page refreshes in Visualforce?
Tagged: Application Event, Partial Page Refreshes, UI, Visualforce
-
How can you create partial page refreshes in Visualforce?
Posted by madhulika shah on August 27, 2018 at 1:26 PMHow can you create partial page refreshes in Visualforce?
Parul replied 7 years, 8 months ago 4 Members · 3 Replies -
3 Replies
-
Hello Madhulika,
Basically, you need to define the section of the page that is going to refresh (typically with a panel of sorts), and then define the event that will cause the refresh. The method changes depending on if the area being refreshed is the same as the one handling the event. It also depends on if you are just processing something on the server, or if you need the UI to change.
Thanks.
- [adinserter block='9']
-
Hi,
You need to use reRender attribute –
Try this –
<apex:actionSupport event=”onclick” reRender=”PageBlockYouWantRefresh”/>
Hope this helps.
-
Adding some more point:
One of the most widely used Ajax behaviours is a partial page refresh, in which only a specific portion of a page is updated/refreshed following some user action, rather than a reload of the entire page.
The simplest way to implement a partial page update is to use the reRender attribute on an <apex:commandLink> or <apex:commandButton> tag to identify a component that should be refreshed. When a user clicks the button or link, only the identified component and all of its child components are refreshed.
For example, consider the contact list example shown in Getting and Setting Query String Parameters on a Single Page. In that example, when a user clicks the name of a contact in the list to view the details for that contact, the entire page is refreshed as a result of this action. With just two modifications to that markup, we can change the behaviour of the page so that only the area below the list refreshes:
1. First, create or identify the portion of the page that should be rerendered. To do this, wrap the <apex:detail> tag in an <apex:outputPanel> tag, and give the output panel an id parameter. The value of id is the name that we can use elsewhere in the page to refer to this area. It must be unique in the page.
2. Next, indicate the point of invocation (the command link) that we want to use to perform a partial page update of the area that we just defined. To do this, add a reRender attribute to the <apex:commandLink> tag, and give it the same value that was assigned to the output panel’s id.
Thanks
Log In to reply.