You need to sign in to do that
Don't have an account?

Adding more text to an apex:outputField (and apex:repeat adding <td> tags)
Hi,
I've been struggling this evening with apex:repeat and also trying to get extra text into this:
<apex:outputField style="font-weight:bold;right" title="Total: " value="{!Quote__c.Quote_Amount__c}"/>
If I made that an outputText then I lose the currency which is a pain... And, as apex:repeat adds:
<apex:panelGrid columns="2" width="100%">
<tr><td>Header 1</td><td>Header2</td></tr>
<apex:repeat><td> (this is the auto created one)
<tr><td><apex:outputField value="bla"/></td><td>Something else here</td></tr>
</td>(and it closes here)</apex:repeat>
</apex:panelGrid>
all on it's own, it completely screws up any tables if you're trying to use <tr>. i.e. tables with a repeat would come out like above.
Is there something I'm doing wrong..? :)
Thanks in advance for any help and suggestions, it's been bugging me for hours!
~acf
Hi Alex,
Check the below link. Hope it helps.
http://community.salesforce.com/sforce/board/message?board.id=Visualforce&thread.id=6247
-AJ
Hi AJ,
Worked a treat, thanks very much..!
You don't happen to have the answer regarding the apex:repeat <td>'s do you? :)
~acf.
Can you explain more about the issue which you face for 'repeat' tag ?
-AJ
Sure, this is the code:
<apex:repeat value="{!SFDC_520_Quote__c.quote_lines__r}" var="line"> <tr><td><apex:outputText value="{!line.product2__r.productcode}"/></td> <td><apex:outputField value="{!line.Qty_Ordered__c}"/></td> <td><apex:outputField value="{!line.product2__r.description}"/></td> <td><apex:outputField value="{!line.Unit_Net_Price__c}"/></td> <td align="right"><apex:outputField value="{!line.Ext_Net_Price__c}"/></td> </tr> </apex:repeat>
The output is:
<td> <tr><td>shipping</td> <td><span id="j_id0:j_id67:1:j_id71">1,234</span></td> <td><span id="j_id0:j_id67:1:j_id73"></span></td> <td><span id="j_id0:j_id67:1:j_id75">£2.00</span></td> <td align="right"><span id="j_id0:j_id67:1:j_id77">£2,468.00</span></td> </tr> </td>
The <td> and </td> create problems for the table layouts as it's entering another column unnecessarily.
~acf
Hmm, OK. Can you think of a way around this, as I'm trying to create a table of outputted information? I've sorted a work around by entering random <td>'s all over my code, which is *far* from pretty nor am I happy with it! :)
After what you've said, it completely makes sense now, it's just a real pain. :)
Thanks,
~acf
Hi
Instead of repeat use dataTable. check the below sample code.
<apex:dataTable value="{!SFDC_520_Quote__c.quote_lines__r}" var="Line">
<apex:column width="13%" > <center> {!Line.Name}</center></apex:column>
<apex:column width="17%" > <center> {!Line.Description__c}</center></apex:column>
</apex:dataTable>
Hope it helps.
-AJ
I assume you've investigated using a pageBlockTable? If you have and found it wanting, I would suggest that you don't use the panelGrid and just handle things using repeat tags. E.g.
<table> <tr> <td>Heading1</td> <td>Heading2</td> </tr> <apex:repeat value="{!myList}" var=element> <tr> <td><apex:outputField value="{!element.field1}"/></td> <td><apex:outputField value="{!element.field2}"/></td> </tr> </apex:repeat> </table>
Hi guys,
Thanks for the information. The label bit sorted me out! I'll give the data bits a go at a later date.
Thanks again!
~acf.