<apex: enhancedList> Component in Visualforce Page

The <apex: enhancedList> is another important component for displaying the list view picklist for an Object. It also displays the associated list of records for the currently selected view.

When this component rerendered through another component's reRender attribute:

  1. It must be specified inside of an <apex: outputPanel> component.
  2. The layout attribute must be set to block.

We cannot use this component on pages with the attribute showHeader set to false. We can only have five enhanced lists on a single VF page.

The <apex: enhancedList> has the following attributes:

1. customizable

The customizable is a Boolean-type attribute that specifies whether the current user can customize the list. The boolean value true is set as a default value for this attribute.

Syntax:

2. height

The height is an integer-type attribute used to specify the list's height in pixels. It is a required attribute for this component.

Syntax:

3. id

The id is a string-type attribute, i.e., a unique identifier that allows this component to be referenced by other components on the page.

Syntax:

4. listId

The listId is a string-type attribute used to specify the database ID of the desired list view. The listId attribute is required when the type is not specified.

Syntax:

5. oncomplete

The oncomplete is a string-type attribute used to specify the JavaScript method that runs when the page refreshes in the browser.

Syntax:

6. rendered

The rendered is a Boolean-type attribute that specifies whether this component is rendered on the page. The boolean value true is set as a default value for this attribute..

Syntax:

7. reRender

The rerender is an Object-type attribute used to specify the Id of one or more components that needs to be redrawn when the result of an AJAX update request completes on the client.

Syntax:

8. rowsPerPage

The rowsPerPage is an integer-type attribute used to specify the number of rows per page. The current user's preference is set as the default value for this attribute. These are the possible values for this attribute:

  1. 10
  2. 25
  3. 50
  4. 100
  5. 200

Syntax:

9. type

The type is a string-type attribute used to specify the Salesforce Object for which views are displayed.

Syntax:

10. width

The width is an integer-type attribute used to specify the width of the list in pixels. By default, its value is the available page or the browser's width.

Syntax:

Let's take an example to understand how we can use the <apex: enhancedList> component on the VF page:

ApexEnhancedListExample.vfp

Output

 apex: enhancedList in Visualforce Page