Primefaces tag rowSelectListener not found.

房东的猫 提交于 2019-12-12 02:44:50

问题


Below is my JSF page.

<?xml version='1.0' encoding='UTF-8' ?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" 
    "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml"
      xmlns:h="http://xmlns.jcp.org/jsf/html"
      xmlns:p="http://primefaces.org/ui">
    <h:head>
        <title>Test page</title>
    </h:head>
    <h:body>
        <p:dataTable var="order" value="#{orderBean.orderList}" 
                     selection="#{orderBean.currentOrder}"
                     selectionMode="single">
            <p:column>
                #{order.customerId.name}
            </p:column>
        </p:dataTable>
    </h:body>
</html>

I want to add a rowSelectListener to the datatable. However my Netbeans IDE does not recognize this as a valid attribute for p:dataTable. Furthermore, it also does not seem to compile. a method called in the listener is not called

rowSelectListener="#{orderBean.onRowSelect}" 

I am working with JSF 2.2 (Mojarra 2.2.7) and Primefaces 5.0


回答1:


It's because there is no rowSelectionListener for primefaces datatable.

You have to use Ajax like this:

<p:ajax event="rowSelect" listener="#{dtSelectionView.onRowSelect}" update=":form:msgs" />
<p:ajax event="rowUnselect" listener="#{dtSelectionView.onRowUnselect}" update=":form:msgs" />

More information available here



来源:https://stackoverflow.com/questions/25084052/primefaces-tag-rowselectlistener-not-found

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!