You need to sign in to do that
Don't have an account?

StandardSetController and Controller Extensions
Hello,
I am trying to take advantage of the new StandardSetController functionality with a custom data set (not driven through a predefined listview filter). I am having difficulty finding the right syntax within the controller to enable this.
I have the following page:
Code:
<apex:page standardController="Account" extensions="ListPOC_Controller" tabStyle="Account" recordSetVar="Accts"> <apex:form id="theForm"> <apex:sectionHeader title="Page: {!pageNumber}" subtitle="Total Results: {!resultSize}"> <apex:pageBlock > <apex:pageBlockTable value="{!Accts}" var="acct"> <apex:column value="{!acct.id}" /> <apex:column value="{!acct.name}" /> </apex:pageBlockTable> </apex:pageBlock> </apex:sectionHeader> </apex:form> </apex:page>
And my most recent cut of the controller extension is as follows:
Code:
public class ListPOC_Controller { public ListPOC_Controller(ApexPages.StandardSetController stdSetController) { // what static var do I need to bind— } public List <Account> getAccts() { return [select id, name from Account limit 25];
}
Is this even possible? Can anyone help me fill in the gaps on the controller extension?
Thanks in advance.
Message Edited by mtbclimber on 10-04-2008 12:10 PM
What you need to do is construct a new StandardSetController object in your Apex controller using the querylocator based constructor. The one you get from the extension is going to be based on the predefined listview filter.
Check out the section titled "Building a Custom List Controller" on page 64 of the Winter '09 Visualforce Developer Guide.
Thanks Andrew, however when I copy the example from the developer's guide straight into a Winter 09 sandbox, I receive an error when I attempt to save the page indicating: 'Unknown Property: Sobject.Name'.
Has anyone else been able to get the sample from the book to work?
Message Edited by ForceDev on 10-06-2008 06:52 AM
Message Edited by ForceDev on 10-06-2008 06:54 AM
Thanks for the quick response Andrew, I will try that and respond to the thread what I find. Before I do that, in looking at your suggestion I am trying to understand if I would be able to take advantage of any of the available StandardListController functionality if what I return to the page is simply a list of Opportunities. What I am trying to do is essentially present a custom data set within the enhanced list view user interface module, where users can select 0 or more records then click on a custom button to perform an action against the selected records.
Am I barking up the wrong tree?
In order to present a selection column you'll actually want to return a collection of wrapper objects instead of sobjects (casted) directly, something like this:
Then you can bind the selection column inputCheckbox to the boolean property and subsequent postbacks will set the value on each respective row accordingly.
Ok, thanks - was afraid of this. Since you allow folks to present this interface along with the filter selection dropdown....I was hoping that you could simply not present the drop down and dictate to the enhanced list view controller what the dataset should be within the controller...would be a nice feature (to take advantage of pagination, robust UI controls, etc.)
I understand the direction I need to go in.
Thanks again for your attention and responses.
Hi,
Is it possible to use this approach to display the output of a dynamic SOQL query on a custom object in an enhanced list. I can't find anything in the documentation that explicitly says this is not possible, but I've had a number of my developers say it can't be done...but it's only enhanced lists that have this problem.
Has anyone ever managed to do this?
Thanks.