Quando uma linha da tabela é selecionada o valor do petSelecionado não é alerado, fica null.
Quando a minha tabela estava como @ViewScoped funcionada...
<h:form id="listaPet">
<p:dataTable var="adm" value="#{listPetPlano.pets}"
paginator="true" rows="20"
paginatorTemplate="{CurrentPageReport} {FirstPageLink} {PreviousPageLink} {PageLinks} {NextPageLink} {LastPageLink} {RowsPerPageDropdown}"
rowsPerPageTemplate="10,20" id="table"
selection="#{listPetPlano.petSelecionado}" selectionMode="single"
rowKey="#{adm.nome}">
<p:ajax event="rowSelect" update=":dadosPlano:animal, :dadosPlano:tipo"/>
<p:column headerText="None" sortBy="#{adm.nome}" id="nome">
<h:outputText value="#{adm.nome}" />
</p:column>
<p:column headerText="Tipo" id="tipo">
<h:outputText value="#{adm.tipoDescricao}" />
</p:column>
<p:column headerText="Data Nascimento" id="data">
<h:outputText value="#{adm.dataNascimento}" />
</p:column>
</p:dataTable>
</h:form>
@ManagedBean(name = "listPetPlano")
public class ListPetBean implements Serializable {
private static final long serialVersionUID = 1L;
List<Pet> pets;
Pet pet;
Pet petSelecionado;
public Pet getPetSelecionado() {
return petSelecionado;
}
public void setPetSelecionado(Pet petSelecionado) {
this.petSelecionado = petSelecionado;
}
public List<Pet> getPets() {
return pets;
}
public void setPets(List<Pet> pets) {
this.pets = pets;
}