You need to sign in to do that
Don't have an account?
How to create HTML table containing apex fields in Visualforce page
I'm trying to create a VF page that displays a table of Opportunity and Contract values. I need to use an IF statement so that blank rows don't get created if the test condition is false. I'm not able to escape the HTML tags so that the browser treats them as HTML instead of text.
Here is an example of what I'm trying to do;
<apex:page standardController="Opportunity">
<table border="1" cellPadding="4">
<TR> <TH> Name of Fee </TH> <TH>Current Fee</TH> <TH> Updated Fee </TH> </TR>
<TR><TD>
{!IF((Opportunity.Contract__r.FieldA = Opportunity.FieldB),
'Standard Fee:' & ' </TD> <TD> ' & TEXT(Opportunity.Contract__r.FieldA) & ' </TD><TD> ' & TEXT(Opportunity.Field) , "" )}
</TD></TR>
</table>
</apex:page>
I had a very long html page with 24 tables populated from data across multiple objects....
What I did was constructed the string in the controller, here is a snippet and not complete:
Then in the page all I had to do was put this to display it:
I can manipulate and dynamically create the string on the fly with the controller without having to update the vf page.
The key is the escape="false" to allow the html code to not be stripped.
All Answers
I had a very long html page with 24 tables populated from data across multiple objects....
What I did was constructed the string in the controller, here is a snippet and not complete:
Then in the page all I had to do was put this to display it:
I can manipulate and dynamically create the string on the fly with the controller without having to update the vf page.
The key is the escape="false" to allow the html code to not be stripped.
Hello,
I am very interested in your example to do an html table from the controller.
Just a single question : what is the return of your function "buildTable" ?
I did something like this :
Problem : I don't know how to display the WHOLE iteration, and not only the last value at index i
any advise ?
You are overwriting tmp with each loop
Change = to += and initially set tmp to ''
Thank you, it works :)