gpt4 book ai didi

salesforce - VisualForce 中的嵌套表问题

转载 作者:行者123 更新时间:2023-12-02 05:42:12 25 4
gpt4 key购买 nike

我在 force.com 顶点模板的 pageBlockSection 中有一个表。在我尝试在我的一个单元格中使用 outputText 标签之前,这一切正常。当我使用这个标签时,额外的单元格和行被添加到标记中。但是,如果我不将表格嵌套在 pageBlockSection 标记中,则不会添加此类单元格。

我是否错误地使用了 outputText,还是 force.com 上存在错误?

这是将重现此问题的最小标记:

<apex:pageBlock title="My Page Block">    
<apex:pageBlockSection title="My Section">
<table>
<tr><th>1</th><th>2</th></tr>
<tr>
<td>
<apex:outputText value="{0}">
<apex:param value="one" />
</apex:outputText>
</td>
<td>
<apex:outputText value="{0}">
<apex:param value="two" />
</apex:outputText>
</td>
</tr>
</table>
</apex:pageBlockSection>
</apex:pageBlock>

这是 force.com 呈现的输出:

<table>
<tbody>
<tr><th>1</th><th>2</th></tr>
<tr>
<td></td>
<td colspan="2" class="dataCol first ">one</td>
</tr>
<tr>
<td colspan="2" class="dataCol "></td>
<td></td>
<td colspan="2" class="dataCol ">two</td>
</tr>
<tr>
<td colspan="2" class="dataCol last "></td>
</tr>
</tbody>
</table>

最佳答案

我不能说它是否真的是一个错误,但我相信它是由 <apex:pageBlockSection> 引起的因为这些会自动将嵌套内容添加到表格中,然后与您自己的表格发生冲突。

我建议要么删除 <apex:pageBlockSection>把你的 table 直接放进<apex:pageBlock> ,或删除您自己的表并利用 <apex:pageBlockSectionItem>元素代替:

<apex:pageBlock title="My Page Block">    
<apex:pageBlockSection title="My Section">
<apex:pageBlockSectionItem >
1
</apex:pageBlockSectionItem>
<apex:pageBlockSectionItem >
2
</apex:pageBlockSectionItem>
<apex:pageBlockSectionItem >
<apex:outputText value="{0}">
<apex:param value="one" />
</apex:outputText>
</apex:pageBlockSectionItem>
<apex:pageBlockSectionItem >
<apex:outputText value="{0}">
<apex:param value="two" />
</apex:outputText>
</apex:pageBlockSectionItem>
</apex:pageBlockSection>
</apex:pageBlock>

关于salesforce - VisualForce 中的嵌套表问题,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/10806950/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com