0

How do I show the value of a field in the blank cell (leftmost cell in 2nd row)? If I put a text within the <th></th> tag, it shows (like the top left cell). But if I put a value of a field (Criteria_1_Label__c), it does not show. enter image description here

Here's my code:

<apex:page standardController="AVTRRT__Job__c" extensions="JobSearchStrategyExt" sidebar="false"
    showHeader="false" applyHtmlTag="true" applyBodyTag="true">
 <apex:form >
 <apex:pageBlock mode="maindetail">
 <apex:variable value="{!SearchStrat}" var="SS"/>
 <style>
    table {border-collapse: collapse; width: 100%;}
    td, th { border: 1px solid #ddd; padding: 8px;}
    tr:nth-child(even){background-color: #f2f2f2;}
    tr:hover {background-color: #ddd;}
    th {padding-top: 12px; padding-bottom: 12px; text-align: left; background-color: #04AA6D; color: white;}
 </style>
<table>
<tr>
    <th>Search Strategy</th>
    <apex:repeat value="{!SearchStrat}" var="SS">
    <td>{!SS.Name}</td>
    </apex:repeat>
</tr>

<tr>
    <th>{!SS.Criteria_1_Label__c}</th>
    <apex:repeat value="{!SearchStrat}" var="SS">
    <td>{!SS.Criteria1Content__c}</td>
    </apex:repeat>
</tr>

</table>

        <div> <apex:commandButton value="Save" action="{!saveSearchStrat}"/> </div>

</apex:pageBlock> 
</apex:form>
</apex:page>

Thanks.

1 Answer 1

0

The answer is use apex:repeat tag then limit rows to 1 so that the value won't repeat

<apex:page standardController="AVTRRT__Job__c" extensions="JobSearchStrategyExt" sidebar="false" showHeader="false" applyHtmlTag="true" applyBodyTag="true">
 <apex:form >
 <apex:pageBlock mode="maindetail">
 <apex:inlineEditSupport/>
 <style>
    table {border-collapse: collapse; width: 100%;}
    td, th { padding: 7px}
    tr:nth-child(even){background-color: #f3f3f3;}
    td:hover {background-color: #efcd75;}
    th {padding-top: 10px; padding-bottom: 10px; text-align: left}
 </style>

<table>

<tr>
    <th>Search Strategy</th>
    <apex:repeat value="{!SearchStrat}" var="SS">
    <td style:>{!SS.Name}</td>
    </apex:repeat>
</tr>

<tr>
    <apex:repeat value="{!SearchStrat}" var="SS" rows="1">
    <th>{!SS.Criteria_1_Label__c}</th>
    </apex:repeat>
    <apex:repeat value="{!SearchStrat}" var="SS">
    <td><apex:outputField value="{!SS.Criteria1Content__c}" /></td>
    </apex:repeat>
</tr>

<tr>
    <apex:repeat value="{!SearchStrat}" var="SS" rows="1">
    <th>{!SS.Criteria2Label__c}</th>
    </apex:repeat>
    <apex:repeat value="{!SearchStrat}" var="SS">
    <td><apex:outputField value="{!SS.Criteria2Content__c}" /></td>
    </apex:repeat>
</tr>


</table>

        <div> <apex:commandButton value="Save" action="{!saveSearchStrat}"/> </div>

</apex:pageBlock> 
</apex:form>
</apex:page>

You must log in to answer this question.