
Please see my code below
I'm trying to dynamically create a table for an email template. The table will have a dynamic number of columns. The above visualforce markup is controlled by a custom controller on the back end and I can provide it if needed but I don't want to overly complicate things.HostedProducts is a list of OpportunityLineItem. The controller decides which OLI fields are queried and sent back to the component. I want to display every queried field for each OLI returned. Because this is dynamic, I don't know the field names until runtime. So I can't use the typical {!hprod.unitprice}.Any direction would be appreciated.Thanks,Max<table class="section">
<tr>
<apex:repeat value="{!hostedHeaders}" var="header">
<th><apex:outputText value="{!header}"></apex:outputText> </th>
</apex:repeat>
</tr>
<apex:repeat value="{!hostedProducts}" var="hProd">
<tr>
<apex:repeat value="{!hProd}" var="prod">
<td><apex:outputText value="{!prod}"></apex:outputText> </td>
</apex:repeat>
</tr>
</apex:repeat>
</table>
3 respuestas
use this syntax{!header[fieldVar1]}{!prod[fieldVar2]}where fieldVar = dynamic field variableAs a common practice, if your question is answered, please choose 1 best answer. But you can give every answer a thumb up if that answer is helpful to you. Thanks