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
SkwalSkwal 

Can getSelected work with EnhancedList in VF page?

1) I am trying again to get selected rows (with getSelected() on the controller) from an Enhanced list view in a VF page. Am I doing something wrong or is it just not possible to pass the EnhancedList records to a custom controller? It seems that the Enhanced list recordset should be bound to the controller records but I cannot figure out where this should happen.

 

2) BTW, I also try to change the FilterID in the EnhancedList but it does not refresh properly. Is this a known issue?

 

Here is the code. Any help would be great.

<apex:page standardController="Contact" extensions="pgContactHomeController" showHeader="true" tabStyle="Contact" recordSetVar="myContacts">

	<apex:form >
        <apex:selectList value="{!FilterID}" size="1">
            <apex:actionSupport event="onchange" rerender="listPanel"/>
            <apex:selectOptions value="{!listviewoptions}"/>
        </apex:selectList>
    </apex:form>
    
	<apex:outputPanel layout="block" id="listPanel">
		<apex:enhancedList height="300" ListId="{!FilterID}" rowsPerPage="10" id="ContactList" customizable="True"  reRender="debugPanel"/>
	</apex:outputPanel>    

	<apex:outputPanel layout="block" id="debugPanel">
    	<apex:pageblock id="myBlock">
	  		<apex:outputText value="Records={!recordCount}" /> <br/>
			<apex:outputText value="Selected={!selectedCount}" /> <br/>
			<apex:outputText value="FilterID={!FilterID}" /> <br/>
		</apex:pageblock>
	</apex:outputPanel>
	
</apex:page>
public with sharing class pgContactHomeController {
    private ApexPages.StandardSetController myController;
    public pgContactHomeController(ApexPages.StandardSetController stdController) {
     this.myController = stdController;
    }
public Integer getRecordCount(){
return ((List<Contact>)myController.getRecords()).size();
}
public Integer getSelectedCount(){
return ((List<Contact>)myController.getSelected()).size();
}
public Id getFilterID(){
return (myController.getFilterID());
}
public void setFilterID(ID newID){
myController.setFilterID(newID);
return;
}
}

 

 

 

im_danim_dan

I am also searching for an answer to this question, does anyone know if this is possible?

jiforcejiforce

yep I am looking for same thing...if there is a solution...

The LorenzThe Lorenz

Did you find a solution to do that? I'm trying to do the same thing. I know it is possible cause I saw it working fine in salesforce GUS.

 

I'm also trying to hide some columns, like the Edit and Del action column. I found a solution with jquery and css but the problem is when the page refreshes the enhanced list (for example when you choose to display more rows per page), it deletes that css rule. Any help will be appreciated.

 

 

Thanks.

 

Lorenzo

Cloud4JCloud4J

I am also looking for a solution ... were you able to solve this problem?

Arun KArun K

Hi  iam working on enahncedlist.

 

 

I have an enhancedlist which shows 120 records(for ex), I want to get no of records which are showing in enhancedlist so that I can use that variable to show as horizontal bar with 120 out 200 recods.

 

If I remove record from enhancedlistas no of records reduces, and It dynamically should update horizontalbar(red bar should show less )

 

 

Please help in this regard,,,,

 

 

MrRigneyMrRigney

Was anyone able to resolve this?

trmptrmp

Anyone find a solution to this?

trmptrmp
FYI, this idea might be of interest for this problem:

https://success.salesforce.com/ideaView?id=08730000000g6wLAAQ
MihahMihah
If anyone is still having problems with enhancedlist not rendering properly when passing the listId parameter based on the selectlist value change, I have just found the solution. The IDs of listviews need to be 15 digit long instead of 18 digits. After that, the enhancedlist will rerender properly based on selected view.

I have found this on Jeff Douglas blog: http://blog.jeffdouglas.com/2014/12/12/enhancedlist-visualforce-component/

A snippet from Jeff Douglas blog:
// for some reason, won't work with 18 digit ID
listId = so.getValue().substring(0,15);
Saved me quite some nerves :)