Search Here

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:


It must be specified inside of an <apex: outputPanel> component.

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:


<apex: enhancedList customizable="false"></apex: enhancedList>  

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:


<apex: enhancedList height="400px"></apex: enhancedList>  

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:


<apex: enhancedList id="listId"></apex: enhancedList>  

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:


<apex: enhancedList listId="databaseId"></apex: enhancedList>  

5. oncomplete

AD


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


Syntax:


<apex: enhancedList oncomplete="apexMethod"></apex: enhancedList>  

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:

AD


<apex: enhancedList rendered="false"></apex: enhancedList>  

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:


<apex: enhancedList rerender="Id1, Id2, Id3, ..."></apex: enhancedList>  

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:


10

25

50

100

200

Syntax:


<apex: enhancedList rowsPerPage="25"></apex: enhancedList>  

9. type


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


Syntax:


<apex: enhancedList type="Account"></apex: enhancedList>  

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:


<apex: enhancedList width="500px"></apex: enhancedList>  

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


ApexEnhancedListExample.vfp


<!-- apex page to understand the use of apex enhancedList component in VF-->  

<apex: page >  

    <apex:enhancedList type="Account" height="300" rowsPerPage="10" id="AccountList" />  

    <apex:enhancedList type="Contact" height="300" rowsPerPage="25" id="contactList" customizable="False"/>  

</apex: page>  

Post a Comment

0 Comments
* Please Don't Spam Here. All the Comments are Reviewed by Admin.