You need to sign in to do that
Don't have an account?
GerhardNewman2
Ideally I want to pass a parameter using something like <apex:repeat value="{!OpportunityLineItems({!aOpportunity.ID})" var="aLineItem"> but it does not accept that if I add a parameter into the getter.
Message Edited by GerhardNewman2 on 06-11-2008 07:17 AM
Message Edited by GerhardNewman2 on 06-11-2008 07:19 AM
Message Edited by GerhardNewman2 on 06-11-2008 07:20 AM
Setters and/or passing value to the controller
I can't find the answer to this anywhere and its driving me crazy.
How can I pass a value into the controller?
Code:
<apex:pageBlock title="Lost Opportunites"> <table width="100%" class="list"> <thead> <tr class='headerRow'><th class='headerRow' scope="col" WIDTH="3%">Action</th><th class='headerRow' scope="col" WIDTH="25%">Opportunity Name</th><th class='headerRow' scope="col" WIDTH="25%">Stage</th><th class='headerRow' WIDTH="20%">Product</th><th class="headerRow"scope="col" align="right" width="8%">Net Line Item</th><th class='headerRow' scope="col" ALIGN="RIGHT" WIDTH="10%">Net Revenue</th></tr> </thead> <apex:repeat value="{!LostOpportunities}" var="aOpportunity"> <tbody><tr> <td><apex:outputLink value="/{!aOpportunity.ID}/e"><b>Edit</b> <apex:param name="retURL" value="/{!id}"/> </apex:outputLink></td> <td colspan="1"><apex:outputLink value="/{!aOpportunity.ID}">{!aOpportunity.Name}</apex:outputLink></td> <td colspan="3"><apex:outputText value="{!aOpportunity.StageName}"><apex:param assignTo="{!OppID}" value="{!aOpportunity.ID}"/></apex:outputText></td> <td align="right">{!aOpportunity.CurrencyIsoCode} {!aOpportunity.Sum_Net_Revenue__c}</td> </tr> <tr><td></td><td></td><td></td><td>{!OppID}</td><td align="right">00</td></tr> <apex:repeat value="{!OpportunityLineItems}" var="aLineItem"> <tr><td></td><td></td><td></td><td>{!aLineItem.PriceBookEntry.Name}</td><td align="right">{!aLineItem.revenue__c}</td></tr> </apex:repeat> </tbody> </apex:repeat> </table> <table width="100%" class="list"><tr align="right"><td><b>Total {!LostTotal}</b></td></tr></table> </apex:pageBlock>
Ideally I want to pass a parameter using something like <apex:repeat value="{!OpportunityLineItems({!aOpportunity.ID})" var="aLineItem"> but it does not accept that if I add a parameter into the getter.
So then I created a String variable (OppID), with a getter and setter, and try to set it using the <apex:param .... > which is in the above code. But the setter never gets called..... I can only assume that the <apex:outputtext> does not support this command, but the documentation does not say anything.
How am I supposed to achieve what I am trying to do? This is a related list on the accounts page. The related list is showing Lost Opportunities. For each Lost Opportunity I want to list each product.
Should I start again with an s-control??
Message Edited by GerhardNewman2 on 06-11-2008 07:17 AM
Message Edited by GerhardNewman2 on 06-11-2008 07:19 AM
Message Edited by GerhardNewman2 on 06-11-2008 07:20 AM
add a join from Opportunity to Product in the SOQL query you must already have in your controller. Once you have this hierarchical result set you can bind to anything in the tree via object dot notation.
Message Edited by dchasman on 06-11-2008 11:35 AM
Can I assume that it's not possible to pass values to the controller like I was asking?
Can I also assume that apex:param does not work how I wanted?
I would like this clarified so I don't ever head off in that direction again.
Thanks very much for your help.
I've got a similar need, but it's a case where I'm grouping records by a field value, as opposed to by a parent record. So using subqueries won't help in my case.
My first thought was basically the same as the OP's (put everything inside a Repeat tag, pass the value of the var of the repeat in to the getter method in order to get the right data back.) But like him, I can't see how to pass that param to the getter.
Thanks much!