Wednesday 9 June 2010

2 uses of the apex:outputPanel tag

Throughout my experience with the force, I have come across a few problems where the solution involved simply the inclusion an apex:outputPanel tag. Below are two uses that are not commonly known.

  1. Multi-component facets

    When using facets, salesforce only allows for a single sub-component as the contents. If you require multiple components, such as an image and text for an action status, then simply enter an apex:outputPanel tag inside the facet, then place all of your components inside.


  2. Partial form refreshing

    When developing apex pages, a common request is to make components appear and hide using the 'rendered' attribute. If a component is hidden, and an action occurs that then requires that component to be shown, you cannot simply re-render the component, as it was never rendered and so does not exist in the current context of the page. Normally this means you have to refresh an entire form, but this can be avoiding using an ouput panel around the components to be shown and hidden, and by using the id of the output panel in the 'reRender' attribute of the action



1 comment: