我有一个DataTable数据表行选择不工作
<p:dataTable id="db"
value="#{notificationBox.notificationsList}"
var="notificationForm"
rows="15"
emptyMessage="${msgs.getMessage('table.empty.message')}"
paginator="true"
paginatorPosition="bottom"
rowKey="#{notificationForm}"
selection="#{notificationBox.notification}"
paginatorTemplate="{CurrentPageReport} {FirstPageLink} {PreviousPageLink} {PageLinks} {NextPageLink} {LastPageLink} (${notificationBox.notificationsList.size()} ${msgs.getMessage('table.records')})"
selectionMode="single"
tableStyle="height:430px">
//Rest of the code
这里如果我选择的任何行,我去为一个Ajax调用(相同primefaces即时行选择的例子)。 Ajax位于Datatable中。
<p:ajax event="rowSelect" listener="#{notificationBox.onRowSelect}"
oncomplete="carDialog.show();" />
我支持bean类 -
private List<NotificationForm> notificationsList;
public NotificationForm notification;
public void onRowSelect(SelectEvent event) {
LOGGER.info("Here. +"+notification);
}
//Setter and Getters.
的问题是,如果我选择任何行, “通知” 即将为空。我无法进一步处理。请帮忙。任何替代方法也是受欢迎的。
编辑: -
我的Managed Bean的范围 -
<managed-bean>
<managed-bean-name>notificationBox</managed-bean-name>
<managed-bean-class>com.comviva.workflow.ui.notification.NotificationBox</managed-bean-class>
<managed-bean-scope>view</managed-bean-scope>
<managed-property>
<property-name>notificationDao</property-name>
<value>#{notificationDaoService}</value>
</managed-property>
<managed-property>
<property-name>userInfoDao</property-name>
<value>#{userInfoDaoProxy}</value>
</managed-property>
</managed-bean>
托管bean的范围是什么? –
你的'rowKey'奇怪地令人怀疑。 PrimeFaces会吃那个吗?它是否实现了equals/hashcode?我从来没有尝试过,但我希望在这里看到一个'#{entity.id}'。 – BalusC
@LuiggiMendoza,在视野范围内。我已经更新了细节。 – theGamblerRises