You need to sign in to do that
Don't have an account?
NaypersMclgx
Function in a pageBlockTable
Hi!, I'd like to know if is possible to have a function in a pageBlockTable that return something to print in a column, I would also like to add a parameter in this function like the example. Anyone know if this can be done, and how?,
thank you!.
My code:
<apex:page sidebar="true" controller="ListOpportunities"> <apex:outputPanel rendered="{!showOpportunities}"> <apex:form > <apex:pageBlock title="{!userName} Opportunities"> <apex:pageBlockTable value="{!myObjectOpportunities}" var="opp"> <apex:column headerValue="Name" > <apex:outputText value="{!opp.name}" /> </apex:column> <apex:column headerValue="Amount" > <apex:outputText value="{!opp.amount}" /> </apex:column> <apex:column headerValue="stageName" > <apex:outputText value="{!opp.stageName}" /> </apex:column> <apex:column headerValue="Id" > <apex:outputText value="{!opp.id}" /> </apex:column> <apex:column headerValue="Custom Field" > <apex:outputText value="validateOpp(opp.id)" /> </apex:column> </apex:pageBlockTable> </apex:pageBlock> </apex:form> </apex:outputPanel> </apex:page>
Try this...
1. Use apex:actionFunction (Documentation) to define your function. use Apex:Param to pass in parameters.
2. Write the function using Javascript
3. Invoke where you need to.
It should however be enclosed within <Apex:form> which you are using anyways.
The above link also has a great example.
- Calvin
You could use a wrapper class:
And the related controller: