我有一个基于OpportunityLineItems对象的数据表,它显示Opportunity记录中的每个Product。现在,我只希望显示通过复选框选中的产品。有没有可能在纯Visualforce中只渲染特定的行?像<apex:DataTable renderrow="{!Oli.Checkbox == True}这样的东西
我只有一个专业执照,所以Apex代码是不可用的。有没有可能只在客户端的VF中这样做?也许JavaScript也可以工作..
以下是我的代码:
<apex:variable var="index" value="{!1}"/>
<apex:dataTable width="100%" value=" !Opportunity.OpportunityLineItems}" var="oli"
<apex:column width="10%" headerClass="tableheaderleft" styleClass="tablebodycenter">
<apex:outputLabel value="{!index}."/>
<apex:variable var="index" value="{!index+1}"/>
<apex:facet name="header"></apex:facet>
</apex:column>
<apex:column width="40%" headerClass="tableheaderleft" styleClass="tablebodyleft">
<apex:facet name="header">Bezeichnung</apex:facet>
<apex:OutputField value="{!oli.Name}"/> <br/>
<table border="0" width="100%" style="border-collapse: collapse; margin-bottom:10px">
<tr><td width="30%" style="padding: 0px;line-height: 100%;"><strong>Leistungszeitraum:</strong> <br></br><apex:outputText value="{0, date, dd.MM.yyyy}">
<apex:param value="{!oli.ServiceDate}" /> </apex:outputText> - <apex:outputText value="{0, date, dd.MM.yyyy}">
<apex:param value="{!oli.Licensing_Period_Calculated__c}" /> </apex:outputText></td></tr>
</table>
</apex:column>
<apex:column width="10%" headerClass="tableheadercenter" footerClass="tablefootercenter" styleClass="tablebodycenter">
<apex:facet name="header">Anzahl</apex:facet>
<apex:OutputField value="{!oli.Quantity}"/>
<apex:facet name="footer"></apex:facet>
</apex:column>
<apex:column width="20%" headerClass="tableheadercenter" styleClass="tablebodycenter">
<apex:facet name="header">Einzelbetrag</apex:facet>
<apex:OutputField value="{!oli.UnitPrice}"/>
<apex:facet name="footer"></apex:facet>
</apex:column>
<apex:column rendered="{!Opportunity.TotalDiscount__c != 0}" headerClass="tableheadercenter" footerClass="tablefootercenter" styleClass="tablebodycenter">
<apex:facet name="header">Rabatt</apex:facet>
<apex:OutputField value="{!oli.Discount}"/>
<apex:facet name="footer"></apex:facet>
</apex:column>
<apex:column width="20%" headerClass="tableheaderright" styleClass="tablebodyright">
<apex:facet name="header">Gesamtbetrag</apex:facet>
<apex:OutputField value="{!oli.TotalPrice}"/>
<apex:facet name="footer"></apex:facet>
</apex:column>
</apex:dataTable>尽可能准确:我不希望整个专栏都隐藏起来。如果我有来自同一列的元素列表:
Element 1 (with checkbox checked)
Element 2 (with checkbox not checked)
Element 3 (with checkbox checked)然后我希望Datatable只输出两行,一行用于元素1,一行用于元素3,因此元素2的行不应该被呈现。
发布于 2020-08-20 01:12:47
不是“顶峰:数据表”,这是一个非常全有或全无的选项,你可以有条件地呈现列,但不能呈现行。尝试使用“顶点:重复”手工制作表格,在循环中输出<tr>, <td>等原始html。您可以将单行的html包装在顶端:输出面板rendered=...或顶点:具有相同条件的变量
(我正在用手机,很抱歉格式化了。如果你还是卡住了,以后再戳我吧)
https://stackoverflow.com/questions/63489009
复制相似问题