• schechter
  • NEWBIE
  • 0 Points
  • Member since 2013

  • Chatter
    Feed
  • 0
    Best Answers
  • 0
    Likes Received
  • 0
    Likes Given
  • 0
    Questions
  • 1
    Replies

I have exactly the same issue as in MD Chen post on ideas. How do you get selected records from a enhancedList? Here is the code:

 

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:page>

 Controller

 

public class testController {

  public testController (ApexPages.StandardSetController controller){
    li=controller;
  }

  public ApexPages.StandardSetController li{get;set;}

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

  public Integer getC2(){
    return ((List<ProfileHierarchy__c>)li.getSelected()).size();
  }
}

Thank you.

 

 

 

  • March 01, 2011
  • Like
  • 0