【发布时间】:2016-06-29 15:41:37
【问题描述】:
在我的dataTable 中,我将每篇文章与特定任务相关联。
单击commandButton 会显示任务列表,因此我想在选择任务时更新dataTable 中的特定单元格(outputText 和id="columnTache")而不更新其余单元格我的dataTable。
<p:dataTable value="#{myController.articleList}"
id="tabArticle"
var="article"
rowKey="#{article.id}" >
<p:column headerText="quantite" >
<pe:inputNumber value="#{article.quantite}" />
</p:column>
<p:column headerText="taches" >
<h:outputText value="#{article.tache.libelleTache}" id="columnTache" />
</p:column>
<p:column headerText="taches" >
<p:commandButton oncomplete="PF('dialogTasks').show();" update=":formSelectAffecterTache">
<p:ajax event="click" listener="#{myController.setArticle(article)}" />
</p:commandButton>
</p:column>
</p:dataTable>
<p:dialog header="#{bundleTech.lbl_taches}" widgetVar="dialogTasks" >
<h:panelGrid columns="1" >
<h:form id="formSelectAffecterTache">
<ui:include src="/pages/listTacheSelect.xhtml">
<ui:param name="bean" value="#{myController}" />
<ui:param name="action" value="affecterTache" />
</ui:include>
</h:form>
</h:panelGrid>
</p:dialog>
我的dataTable的更新在托管bean中:
public void affecterTache() {
article.setTache(selectedSingleTache);
RequestContext.getCurrentInstance().update("form:tabArticle");
}
【问题讨论】:
-
您的数据表正在完全更新,因为您的
RequestContext.getCurrentInstance().update("form:tabArticle");。 -
正是@hamza-don 我必须编辑什么,以便它只更新id为columnTache的单元格
-
你为什么不使用数据表的Cell Edit 功能。
标签: jsf primefaces datatable