2012-08-13 81 views
0

我在visualforce頁面中設置了一些HTML表格,其中一些功能似乎超出了標準apex:datatable的掌握範圍。當用戶更新其中一個行的信息時,我試圖重新渲染表,以便反映更新後的值。如果我使用apex:datatable這可以正常工作,但是然後我失去了很多我必須添加到我的表中的功能。apex:actionFunction在非Visualforce組件上重新渲染

結構相當簡單,但是這是怎麼一回事呢:

<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> 

這在本質上,我試圖完成的功能,與它下面列出的父對象的孩子。到目前爲止,rerender會將我所有的表格元素轉換爲跨度,並完全無法處理所有內容。是否有可能重新渲染一個非Visualforce組件,或者,有沒有一種方法可以在apex中重現此功能:datatable?

謝謝!

+0

我沒有在這裏看到任何問題,只是reRender你的「桌面」? – mast0r 2012-08-14 07:05:06

回答

0

我實際上最終發現了apex:outputPanel元素的漂亮的小布局屬性。將其設置爲「阻止」可以完全解決與此相關的所有問題。

0

它很容易。試試這個,即使在退貨後也能正常工作:

<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> 

Noe你可以reRender你的「myTable」。

+0

當然有趣,我將如何去添加多個列?我有12個確切的,從我所看到的,它必須全部被渲染爲TD的沒有標題的選項.. – jsfdev01 2012-08-17 23:47:56