0
votes

I have this code in my view, but I can't invoke listener method when selecting any row. Each event points to a method that only prints a text in the console so I make sure it works, but it doesn't. I'm wondering if I'm missing something?

<p:panelGrid columns="2">
    <p:column>
        <h:form id="formSelectEmployee">
            <p:dataTable 
                id="employeeDataTable" 
                var="employee"
                value="#{employeeController.employeeList}" 
                selectionMode="single" 
                selection="#{employeeController.selectedEmployee}"
                rowKey="#{employee.id}">

                <p:ajax event="rowSelect" listener="#{employeeController.selectEmployee}" update=":tabs" />
                <p:ajax event="rowUnselect" listener="#{employeeController.unSelectEmployee}" update=":tabs" />

                <p:column>
                    <h:outputText value="#{employee.fullName}" />
                </p:column>

            </p:dataTable>
        </h:form>
    </p:column>
</p:panelGrid>
1
I'm including it in the question because it's how I have it. Anyways, it doesn't matter if it's in/outside the panelgrid, the item is not being selected and I get no error message.Alejandro

1 Answers

0
votes

Adding

<p:commandLink action="#{employeeController.selectEmployee(employee)}">
    <h:outputText value="#{employee.fullName}" />
</p:commandLink>

Did the same as rowSelect event =)