【发布时间】:2013-09-17 18:32:27
【问题描述】:
我在使用复选框的 dataTable 多选时遇到问题(如第二个:http://primefaces.org/showcase/ui/datatableRowSelectionRadioCheckbox.jsf)。 当我尝试在我的 backingBean 中执行一个方法时,所选项目总是具有正确的大小,但是具有相同的对象。 示例:我在 dataTable 中选择了三个消息:消息 1、消息 2 和消息 3。当我在 JSF 页面中执行我的方法时,我选择的项目如下:
Messages[0] = Message 1
Messages[1] = Message 1
Messages[2] = Message 1
这是我的 JSF 页面:
<p:dataTable id="mensagensLidas" var="msg" value="#{mensagensBean.msgGrupoModel}"
paginator="true" rows="10" selection="#{mensagensBean.selectedMsgsGrupo}">
<p:column selectionMode="multiple" style="width:2%"/>
<p:column headerText="Titulo:" style="width:49%">
#{msg.titulo}
</p:column>
<f:facet name="footer">
<p:commandButton id="multiViewButton" value="#{msgs.delete}" icon="ui-icon-trash" actionListener="#{mensagensBean.excluirMsgsGrupo}" update=":tabMain" ajax="true"/>
</f:facet>
</p:dataTable>
【问题讨论】:
-
为什么 selectionMode="multiple" 在列中,而不是像这里 primefaces.org/showcase/ui/datatableRowSelectionMultiple.jsf 那样在数据表中?
-
编辑了问题,就像第二个例子:primefaces.org/showcase/ui/…
-
你能把代码也放在你打印数据的地方吗?
标签: jsf primefaces datatable