我在视觉力量页面中设置了一个HTML表格,其中有一些功能似乎超出了标准apex:datatable的掌握范围。当用户更新其中一行的信息时,我正在尝试重新呈现表,以便反映更新的值。如果我使用 apex:datatable,这工作正常,但随后我失去了许多必须在表中添加的功能。
结构相当简单,但事情是这样的:
<table>
<thead>
<tr>
<th>Col 1</th>
</tr>
</thead>
<tbody>
<apex:outputPanel id="table-panel">
<apex:repeat value="{!Parent}" var="row">
<tr name="{!row.Id}">
<td>Cell 1</td>
</tr>
<apex:repeat value="Child__r" var="child">
<tr name="child-{!row.Id}">
<td>Child Cell 1</td>
</tr>
</apex:repeat>
</apex:repeat>
</apex:outputPanel>
</tbody>
</table>
这本质上是我试图完成的功能,其下方列出了父对象的子对象。截至目前,重新渲染将我所有的表元素转换为跨度,并完全乱码。是否可以重新渲染非视觉力组件,或者,是否有办法在 apex:datatable 中重现此功能?
谢谢!
这很容易。试试这个,即使在重新渲染后也能正常工作:
<apex:panelGrid columns="1" width="400" id="myTable">
<apex:facet name="header">
<apex:outputText value="My table header"/>
</apex:facet>
<apex:repeat value="{!Object}" var="row">
<apex:outputText value="{!row.name}" style="display:block;font-weight:bold;"/>
<apex:repeat value="{!row.ObjectChild__r}" var="child">
<apex:outputText value="{!child.name}"/> <br/>
</apex:repeat>
</apex:repeat>
</apex:panelGrid>
不,你可以重新渲染你的"我的表"。
实际上,我最终发现了apex:outputPanel元素的漂亮的小"layout"属性。将其设置为"阻止"完全解决了与此相关的所有问题。