Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8891943
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 14, 20262026-06-14T22:52:12+00:00 2026-06-14T22:52:12+00:00

I have a dataTable but when I select a row nothing happens, I’ve tried

  • 0

I have a dataTable but when I select a row nothing happens, I’ve tried calling p:dialog and nothing happened. I tried to redirect to another page with the selected data and also could not (this is my goal). What is missing in my code do. Below is my xhtml and bean.

xhtm:

<h:form id="form" style="font-size: 11pt">
<h3>Cancelar Processo de Portabilidade</h3>

<p:panel header="Consulta por Numeração" id="CancProcP1">


<h:panelGrid columns="3" style="margin-bottom:10px" cellpadding="5"
    id="pgridTipoCanc1">

    <p:selectOneRadio id="tipoCancela"
        value="#{beanBuscarDadosCancPort.tipoBusca}">
        <f:selectItem itemLabel="TN" itemValue="1" />
        <f:selectItem itemLabel="Bilhete" itemValue="2" />
        <f:selectItem itemLabel="Período" itemValue="3" />
        <f:ajax render="pgridTipoCanc2" />
    </p:selectOneRadio>

</h:panelGrid>

<h:panelGrid columns="2" style="margin-bottom:10px" cellpadding="5"
    id="pgridTipoCanc2">

    <h:outputLabel for="tn" value="TN:"
        rendered="#{beanBuscarDadosCancPort.tipoBusca == '1'}" />
    <h:inputText id="tn" value="#{beanBuscarDadosCancPort.tn}"
        rendered="#{beanBuscarDadosCancPort.tipoBusca == '1'}" />

    <h:outputLabel for="bilhete" value="Bilhete de Portabilidade:"
        rendered="#{beanBuscarDadosCancPort.tipoBusca == '2'}" />
    <h:inputText id="bilhete"
        value="#{beanBuscarDadosCancPort.srvProvId}"
        rendered="#{beanBuscarDadosCancPort.tipoBusca == '2'}" />

    <h:outputLabel for="dataInicial" value="Data Inicial"
        rendered="#{beanBuscarDadosCancPort.tipoBusca == '3'}" />
    <p:calendar id="dataInicial"
        value="#{beanBuscarDadosCancPort.dataInicial}"
        rendered="#{beanBuscarDadosCancPort.tipoBusca == '3'}" />

    <h:outputLabel for="dataFinal" value="Data Final"
        rendered="#{beanBuscarDadosCancPort.tipoBusca == '3'}" />
    <p:calendar id="dataFinal"
        value="#{beanBuscarDadosCancPort.dataFinal}"
        rendered="#{beanBuscarDadosCancPort.tipoBusca == '3'}" />

</h:panelGrid>

<p:commandButton id="pesquisar"
    action="#{beanBuscarDadosCancPort.pesquisar}"
    value="Buscar" ajax="false" update="display" />

</p:panel>
</h:form>

<p:panel id="CancProcP2">

<h:form id="form2" style="font-size: 11pt">

<p:growl id="growl" showDetail="true"/>                 

<p:dataTable id="dataTable" var="valor"
    value="#{beanBuscarDadosCancPort.listaNumeroPortado}" 
    paginator="true" rows="5" rowKey="#{valor.srvProvIdDoadoraAnterior}" 
    selection="#{beanBuscarDadosCancPort.selectedNumP}" selectionMode="single"
    rowSelectListener="#{beanBuscarDadosCancPort.onRowSelect}"
    onRowSelectUpdate="display growl"
    onRowSelectComplete="carDialog.show()"
    rowUnselectListener="#{beanBuscarDadosCancPort.onRowUnselect}"  
    onRowUnselectUpdate="growl"
    paginatorTemplate="{CurrentPageReport}  {FirstPageLink} {PreviousPageLink} {PageLinks} {NextPageLink} {LastPageLink} {RowsPerPageDropdown}"
    rowsPerPageTemplate="4,5,7"
    style="max-width: 580px; min-width: 550px">
    <f:facet name="header"> 

</f:facet>

<p:column selectionMode="single" style="width:18px" />  

<p:column
        style="max-width: 50px; min-width: 50px; overflow: hidden">
        <f:facet name="header">
            <h:outputText value="Operadora Doadora" />
        </f:facet>
        <h:outputText value="#{valor.srvProvIdDoadoraAnterior}" />
    </p:column>

    <p:column
        style="max-width: 40px; min-width: 40px; overflow: hidden">
        <f:facet name="header">
            <h:outputText value="Bilhete" />
        </f:facet>
        <h:outputText value="#{valor.srvProvId}" />
    </p:column>

    <p:column
        style="max-width: 40px; min-width: 40px; overflow: hidden">
        <f:facet name="header">
            <h:outputText value="Data/Hora da Janela" />
        </f:facet>
        <h:outputText value="#{valor.dataJanelaPortabilidade}" />
    </p:column>

    <p:column
        style="max-width: 40px; min-width: 40px; overflow: hidden">
        <f:facet name="header">
            <h:outputText value="Telefone" />
        </f:facet>
        <h:outputText value="#{valor.tn}" />
    </p:column>



</p:dataTable>

<p:dialog header="Car Detail" widgetVar="carDialog" resizable="false"  
width="200" showEffect="explode" hideEffect="explode">

    <h:panelGrid id="display" columns="2" cellpadding="4">  

        <f:facet name="header">  
        <p:graphicImage value="teste"/>  
        </f:facet>  

        <h:outputText value="Model:" />  
        <h:outputText value="#{beanBuscarDadosCancPort.selectedNumP.srvProvIdDoadoraAnterior}" /> 

    </h:panelGrid>

</p:dialog>

</h:form>

Bean

public class BuscarDadosCancelarPortBean implements Serializable {

    private static final long serialVersionUID = 1L;

    private List<NumeroPortado> regSelecionado = null;

    private String tipoBusca;
    private String tn;
    private String srvProvId;
    private Date dataInicial;
    private Date dataFinal;

    private List<NumeroPortado> listaNumeroPortado = null;
    NumeroPortado numPortato = new NumeroPortado(); 

    private NumPortadoDataModel numModel;

    private NumeroPortado selectedNumP; 


    @EJB
    private ConsultasSpnService consultaOp;

    public List<NumeroPortado> pesquisar(){

        String busca = null;
        //String busca = "tn";
        //String parametro = "1133100038";
        String parametro = null;
        String parametro2 = null;

        if(tipoBusca.equals("1")){

            parametro = tn;
            busca = "tn";

        }else if(tipoBusca.equals("2")){

            parametro = srvProvId;//bilhete
            busca = "bilhete";

        }else if(tipoBusca.equals("3")){

            //DateFormat df = new SimpleDateFormat("dd/MM/yy"); 

            //parametro = df.format(dataInicial);
            //parametro2 = df.format(dataFinal);
            //busca = "data";

        }       

        if(listaNumeroPortado == null){
            listaNumeroPortado = new ArrayList<NumeroPortado>();
            listaNumeroPortado = consultaOp.listarNumerosPortados(busca, parametro, parametro2);

            //Excluir depois de descobrir porque não está pegando estes campos da tabela
            for(int i=0;i<listaNumeroPortado.size();i++){

                if(tipoBusca.equals("1")){
                    listaNumeroPortado.get(i).setTn(parametro);
                }else if(tipoBusca.equals("2")){
                    listaNumeroPortado.get(i).setSrvProvId(parametro);
                }


            }
            //numModel = new NumPortadoDataModel(listaNumeroPortado);



        }   


        return listaNumeroPortado;



    }

    public String getTn() {
        return tn;
    }
    public void setTn(String tn) {
        this.tn = tn;
    }
    public String getSrvProvId() {
        return srvProvId;
    }
    public void setSrvProvId(String srvProvId) {
        this.srvProvId = srvProvId;
    }
    public Date getDataInicial() {
        return dataInicial;
    }
    public void setDataInicial(Date dataInicial) {
        this.dataInicial = dataInicial;
    }
    public Date getDataFinal() {
        return dataFinal;
    }
    public void setDataFinal(Date dataFinal) {
        this.dataFinal = dataFinal;
    }

    public String getTipoBusca() {
        return tipoBusca;
    }

    public void setTipoBusca(String tipoBusca) {
        this.tipoBusca = tipoBusca;
    }

    public List<NumeroPortado> getListaNumeroPortado() {
        return listaNumeroPortado;
    }

    public void setListaNumeroPortado(List<NumeroPortado> listaNumeroPortado) {
        this.listaNumeroPortado = listaNumeroPortado;
    }

    public NumeroPortado getNumPortato() {
        return numPortato;
    }

    public void setNumPortato(NumeroPortado numPortato) {
        this.numPortato = numPortato;
    }

    public ConsultasSpnService getConsultaOp() {
        return consultaOp;
    }

    public void setConsultaOp(ConsultasSpnService consultaOp) {
        this.consultaOp = consultaOp;
    }

    public List<NumeroPortado> getRegSelecionado() {
        return regSelecionado;
    }

    public void setRegSelecionado(List<NumeroPortado> regSelecionado) {
        this.regSelecionado = regSelecionado;
    }

    public NumPortadoDataModel getNumModel() {
        return numModel;
    }

    public void setNumModel(NumPortadoDataModel numModel) {
        this.numModel = numModel;
    }

    public NumeroPortado getSelectedNumP() {
        return selectedNumP;
    }

    public void setSelectedNumP(NumeroPortado selectedNumP) {
        this.selectedNumP = selectedNumP;
    } 

    public void onRowSelect(SelectEvent event) {  
        FacesMessage msg = new FacesMessage("Line Selected", ((NumeroPortado) event.getObject()).getTn());  

        FacesContext.getCurrentInstance().addMessage(null, msg);  
    }  

    public void onRowUnselect(UnselectEvent event) {  
        FacesMessage msg = new FacesMessage("Line Unselected", ((NumeroPortado) event.getObject()).getTn());  

        FacesContext.getCurrentInstance().addMessage(null, msg);  
    }  

    public String onRowSelectNavigate(SelectEvent event) {  
        FacesContext.getCurrentInstance().getExternalContext().getFlash().put("selectedNumP", event.getObject());  

        return "cancelarPortabilidade?faces-redirect=true";  
    }

}

I changed the rowSelectListener = "#{beanBuscarDadosCancPort.onRowSelect}" by rowSelectListener = "#{beanBuscarDadosCancPort.onRowSelectNavigate}" without success!

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-14T22:52:14+00:00Added an answer on June 14, 2026 at 10:52 pm

    I got using only the tag
    <p:ajax event="rowSelect" listener="# {beanConsultaPorNum.onRowSelectHeader}" /> between <p:dataTable...> </p:dataTable>.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a dataset with just 1 datatable and 1 row but with 2
i have a data table..but it can't select one row after click the row..
I have painted a datatable with checkbox's against each row. Now when i select
I have a datatable where i am trying to do datatable.Select(Name Like '#%#') but
I have a fileDownload component inside a dataTable but when I click it it
I have created a datatable and trying to insert that datatable through SqlBulkCopy but
I have following function that converts normal DataTable to Pivot Table. But I have
I have a DataTable which has some rows and I am using the select
I have a <ice:dataTable> and I want to add a checkbox to each row.
I have a DataTable, say pdt, in my code. I just want to select

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.