Wednesday 5 September 2012

Add Attributes Using Auto-Suggest - Visualforce

Let’s play some more with our first hello page. It turns out that the sidebar attribute is a valid attribute for the <apex:page> component.
  1. Add sidebar="false" within the start tag of the <apex:page> component as follows:
    <apex:page sidebar="false">
  2. Click Save.
    Notice that the left hand area of your page has changed—the sidebar has been removed. In effect, the sidebar attribute modifies the behavior and appearance of the<apex:page> component.
    A Visualforce Page with the Sidebar Removed
  3. Position your cursor just after the final quotation mark ("), and hit the space bar. A helpful list of attributes pop up that are valid for the <apex:page> component. Choose the showHeader attribute.
  4. The attribute is automatically added to your page, and you now need to supply a value for the attribute. Add false. Your complete first line should look like this:
    <apex:page sidebar="false" showHeader="false">
  5. Click Save (remember, you can also press CTRL+S as a shortcut).
    This time your page looks completely different. By setting the showHeader attribute to false, you’ve not only removed the top header, but all the default styling associated with the page.
    A Visualforce Page with a Sidebar and Header
    Let’s put it back the way it was—having the top header is very useful during development.
  6. Change the showHeader attribute’s value to true.
  7. Click Save.

No comments:

Post a Comment