+ Start a Discussion

How to get all selected rows/records from enhancedlist view

Hi, I need to deal with the selected records from enhancedlist view. In my custom controller, I always get "c2=0" by using controller.getSelected() whenever I make the selection in the listview and then click the "get seleted" link.   What is the event for the selection?


And getRecords() can not return more than 20 that is not useful for the project.


And getRecords() can not get refresh when I select another view in the view option dropdown list.

I really appraciate if anybody has a idea! 


My test page:

<apex:page standardController="ProfileHierarchy__c" recordSetvar="profiles" extensions="testController">

<apex:enhancedlist type="ProfileHierarchy__c" height="200" rerender="c1,c2" />

<apex:outputText id="c1" value="c1={!c1}" /> <br>
<apex:outputText id="c2" value="c2={!c2}" /> <br>
<apex:form >
<apex:commandLink action="{!setC2}" value="get selected" reRender="c2" />

my controller:

 public class testController {

public testController (ApexPages.StandardSetController controller)

public ApexPages.StandardSetController li{get;set;}


public Integer getC1(){
return ((List<ProfileHierarchy__c>)li.getRecords()).size();

public Integer c2=0;
public Integer getC2(){
 return c2;
public void setC2(){
 c2 = ((List<ProfileHierarchy__c>)li.getSelected()).size()+1;



Hi. Were you able to solve this?  

I have been trying to retrieve selected records from an enhanced list in a VF page without success.  Already tried using StandardSetController and it does not get the records.


Any hint is very appreciated.


By the way!

Do you have to find a solution to the problem?


Did anyone here find a solution to this?


This idea might help if it were to be implemented: