You need to sign in to do that
Don't have an account?
Maeze Ahlers
How can you specify a specific list for 3 different columns of pageblocksections?
I'm trying to create a page that shows three columns each referencing a specified list (that will eventually be customizeable) of opportunities. Basically, I need to assign a specific listview to a pageblocksection. I've attached my code and a screenshot any help would be great!!
<apex:page standardcontroller="opportunity" recordsetvar="opportunities" id="pageopp" > <apex:form > <apex:pageblock title="pageblocktitle"> <apex:pageblockbuttons > <apex:commandButton value="Save" action="{!save}"/> <apex:commandButton value="Quick Save" action="{!save}"/> </apex:pageblockbuttons> <apex:panelgrid columns="4"> <apex:outputPanel > <apex:pageblock title="pageblocktitle1"> <apex:pageblocksection > <apex:repeat value="{!opportunities}" var="opp" id="rep"> <apex:pageblocksection title="{!opp.name}"> </apex:pageblocksection> </apex:repeat> </apex:pageblocksection> </apex:pageblock> </apex:outputpanel> <apex:outputPanel > <apex:pageblock title="pageblocktitle1"> <apex:pageblocksection > <apex:repeat value="{!opportunities}" var="opp" id="rep"> <apex:pageblocksection title="{!opp.name}"> </apex:pageblocksection> </apex:repeat> </apex:pageblocksection> </apex:pageblock> </apex:outputpanel> <apex:outputPanel > <apex:pageblock title="pageblocktitle1"> <apex:pageblocksection > <apex:repeat value="{!opportunities}" var="opp" id="rep"> <apex:pageblocksection title="{!opp.name}"> </apex:pageblocksection> </apex:repeat> </apex:pageblocksection> </apex:pageblock> </apex:outputpanel> </apex:panelgrid> </apex:pageblock> </apex:form> </apex:page>
Hi Maez,
You have a few different options here. Declaritively, you could simply have the users utilize the existing list view tab classic or lightning experience and toggle between one of the three or more list views.
If you're getting ready to switch to Lightning Experience, then you could also just add a related list component to the record detail page of the parent record (whether it's an account or some other object). The related lists would then allow you to filter by a different list view, giving you similar functionality to what your Visualforce page would look like.
Next, if you're keen on keeping the Visualforce page, then you could use a series of repeats and the "rendered" attribute to determine which list to display when.
Last, and proably most likely, you're looking at extending your Visualforce page with an Apex controller. In the Apex controller, you'd take the recordSetVar and determine which "list views" or criteria to display in code, and then render those lists back in Visualforce. I took a quick stab at this example.
In my example, I'm filtering by one of three stages (Closed Won, Closed Lost, and Prospecting). Depending on the stage, I'm adding the opportunities to one of the three lists and then showing it in Visualforce.
Here's the Apex extension controller:
And here is the Visualforce page for the example:
Hope that helps
Thank you for all of the info. I think the extension controller might be a little above my pay grade. If I were to do the second option can you give me an example of how I could modify my current code to fit that? Thank you in advance!