我在哪裏需要使用JSF 2.0和jQuery/javaScript。有沒有一種方法來添加列數據表而不重新渲染整個表
我試圖以動態的方式添加和刪除數據表中的列。 問題是 - 據我所知,我必須重新渲染整個表來添加或刪除列,並且實際上需要對錶中的所有數據進行提取,但在大多數情況下,這並不是必需的。
例如(對於問題說明的目的打字,可能存在語法錯誤,但假設他們不這樣做):渲染和未呈現列時
<h:dataTable id="table">
<h:column id="cul1" rendered="#{mrBean.isCul1_rendered} >
...
</h:column>
<h:column id="cul2" rendered="#{mrBean.isCul2_rendered} >
...
</h:column>
</h:dataTable>
<f:ajax render="table" />
<h:commandButton action="#{mrBean.switchIsCul1}" >Switch Cul1</h:commandButton>
<h:commandButton action="#{mrBean.switchIsCul2}" >Switch Cul2</h:commandButton>
</f:ajax>
如圖所示,整個表被重新渲染。有沒有辦法只渲染變化的列? (據我所知,render="cul1
,將無法正常工作)
謝謝!
TnX。我有點希望用這個功能保存瀏覽器服務器的帶寬,但我想這是不可能的...... – Ben