function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion
V AnandV Anand 

can we use getselected() method with wrapper classes?

Hi.......

 

I want to display selected contacts in standard list view  and print those selected contacts in visualforce page .......

cloudElephantcloudElephant

Hi vel123,

 

getselected method is not available for wrapper class.

 

I am not clear with your requirement here. To print selected contacts from Standard List View,  can't you use recordSetVar and standard getSelected method to retrieve sobject list and then iterate over it to form your wrapper class objects?

 

Another approach to get seleted record Ids is GETRECORDIDS formula.

 

Please let me know if this helps.

V AnandV Anand

Thank you for replying .............

 

my Intention is  when retrieving records for getselected() method I  want to increment count for each record.... How can I do that ..........my controller is

 

public class quickEmailController{
    
    ApexPages.StandardsetController setCon;

    public quickEmailController(ApexPages.StandardsetController controller)
    {
        setCon = controller; 
    }
      
    public pageReference doSomething()
    {
        for ( contact acc : (contact[])setCon.getSelected() )
        {
        }
        
        return null;
      }  

visualforce page is....

  

<apex:page standardController="contact" recordSetVar="listofobject"
 standardStylesheets="false" extensions="quickEmailController" renderAs="pdf">
  <apex:form >
  <apex:pageBlock >
        <apex:pageBlockSection columns="1" >   
            <apex:dataTable value="{!selected}" var="item1"   rowClasses="odd,even">  
             <apex:column id="pb" >
              <table  width="700" border="">  
                     <apex:outputpanel rendered="{!IF(AND(MOD(count,5) == 0), true, false)}">       // I want to rendered this panel  using record count .   
                     <br/>
                     <DIV style="page-break-after: always"></DIV>
                     <br/>           
                    </apex:outputpanel>-->  
                        <tr><td><br/></td></tr>
                        <!--<tr><td>{!tc}</td></tr>-->                    
                        <tr><td width="100"><b>{!item1.salutation}</b>.{!item1.firstname} {{!item1.lastname}</td></tr>          
                        <tr><td>{!nullValue(item1.mailingstreet,'')}</td></tr>          
                        <tr><td>{!nullValue(item1.mailingcity,'')} {!item1.mailingstate} {!item1.mailingpostalcode} </td></tr>      
                        <tr><td>{!nullValue(item1.mailingcountry,'')} </td></tr>
                        <tr><td><b>Phone:</b> {!item1.phone} </td></tr>
                        <tr><td><br/></td></tr>
                        <hr  width="100%" > </hr>                            
                    </table>
                    </apex:column>   
            </apex:dataTable>     
        </apex:pageBlockSection>
   </apex:pageBlock>
</apex:form>

 

I created list button(pdf) for calling this visualforce  and placed this button on standard list view ,now I am selecting some contacts and  click pdf list button then display selected contacts in visualforce page with only 5 records per page for this purpose I am rendering  <apex:outputpanel rendered="{!IF(AND(MOD(count,5) == 0), true, false)}">   for page break .How to increment count in my extension.