PrimeFaces逐行展开单击 [英] PrimeFaces expand row on row click
本文介绍了PrimeFaces逐行展开单击的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我有 RowExpansion dataTable
I have RowExpansion dataTable
<p:dataTable value="#{clients.clients}" var="client">
<p:column>
<p:rowToggler />
</p:column>
<p:column headerText="name" sortBy="#{client.name}">
<h:outputText value="#{client.name}"/>
</p:column>
<p:column headerText="email" sortBy="#{client.email}">
<h:outputText value="#{client.email}" />
</p:column>
<p:rowExpansion>
<p:panelGrid columns="2">
<h:outputText value="Id:" />
<h:outputText value="#{client.id}" />
</p:panelGrid>
</p:rowExpansion>
</p:dataTable>
我需要做两件事:
- 展开逐行点击
- 隐藏先前的扩展行.
那怎么做呢?
推荐答案
我刚刚在Primefaces 5.1中实现了@Hatem Aliman的解决方案,到目前为止效果很好.
I just implemented the solution of @Hatem Aliman in Primefaces 5.1 and it works fine so far.
如果启用了rowExpandMode="single"
,则无需自己关闭打开的行.只需将以下行注释掉:$this.collapseAllRows();
If you enabled rowExpandMode="single"
, you don't need to close the opened rows by yourself. Just comment out the row: $this.collapseAllRows();
这篇关于PrimeFaces逐行展开单击的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文