2012-05-10 31 views
0

我有一個與Visualforce電子郵件模板相關的問題,請幫我解決。 我使用下面的代碼隱藏TR:我們如何在電子郵件模板中使用條件語句?

<apex:repeat var="cx" value="{!relatedTo.Airline_Conf_s__r}"> 
<tr style="{!IF(!cx.Include_in_Confirmation__c == true,"display:none!important; ","")}"> 
<td> 
<apex:outputText value="{!cx.Airlines_Url__c}" escape="false" /> 
</td> 
</tr> 
</apex:repeat> 

but i need it to done without inline style .how can it possible. 

回答

1

你可以嘗試使用頂點「繪製的」屬性:的outputText,這樣

<apex:outputText rendered = "{cx.Include_in_Confirmation__c}" value="{!cx.Airlines_Url__c}" escape="false" /> 
1

您最好使用頂點:outputPanel標籤和使用rendered屬性:

<apex:repeat var="cx" value="{!relatedTo.Airline_Conf_s__r}"> 
<apex:outputPanel layout="none" rendered="{!cx.Include_in_Confirmation__c == true}"> 
    <tr> 
     <td> 
      <apex:outputText value="{!cx.Airlines_Url__c}" escape="false" /> 
     </td> 
    </tr> 
</apex:outputPanel> 

注意,外行out屬性被設置爲「none」,這將有效地告訴VF不要渲染標籤,但是你會得到能夠在中繼器循環時動態呈現TR標籤的好處。

相關問題