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 8711649
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 13, 20262026-06-13T04:55:53+00:00 2026-06-13T04:55:53+00:00

I am using primefaces for not so long and Ive found that I cant

  • 0

I am using primefaces for not so long and Ive found that I cant use a <p:commandButton /> because it just can’t reach the method, the method is ok, I tried it out of the table (and the subtable) and it works perfectly there (everything is inside a form) , the problem is that I need the user to be able to select all the subtable, so, I thought maybe with a button that could be possible, but seems like subtable doesn’t allow that, any other way I can do this? or maybe I have to use another way for call my method from a subtable, anybody knows about it?

Thanks

some of my code

<h:form>
    <p:messages id="messages" showDetail="true" autoUpdate="true" closable="true" />  
    <p:dataTable id="case" var="ticket" value="#{CaseBean.selectedCase.tickets}">
        <p:columnGroup>
            <p:row>
                <p:column> Action:</p:column>
                <p:column>
                    <!-- This doesn't work, removed. -->
                    <p:commandButton value="Aprove" action="#{CaseBean.acept()}">
                    </p:commandButton>
                </p:column>
            </p:row>
        </p:columnGroup>

        <p:subTable var="detail" value="#{ticket.detail}">
            <f:facet name="header">
                Resume:
            </f:facet>
            <!-- some data... -->
            <p:column>
                <!-- doesn't work either -->
                <p:commandButton value="Aprove" action="#{CaseBean.aceptTicket()}">
                </p:commandButton>
            </p:column>
<!-- show my data -->

The table works perfectly, it shows all the data, the log files doesn’t show any error, so, when I tried to write my commandButton out of the table it worked perfectly, if I cant write it inside a subtable its ok, but , how could I write it in the table? it doesn’t show up there either.

  • 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-13T04:55:54+00:00Added an answer on June 13, 2026 at 4:55 am

    you welcome 🙂
    But if i was you I wouldn’t use subtables, Ill think for another solution..maybe Ill do it this way, ill use two different data tables, the first contains the parent list and the second one contains the child list elements, and every selection made triggers an update of the second table…I tried it on my IDE and it works just fine

    <h:form id="form">
    <p:dataTable var="cas" value="#{beanCase.myListOfCase}"
        selection="#{beanCase.selectedCase}" rowKey="#{cas.idCase}"
        selectionMode="single">
        <p:ajax event="rowSelect" update=":form:TicketTable" />
        <p:column headerText="Id Case">
            <h:outputText value="#{cas.idCase}" />
        </p:column>
        <p:column headerText="Case Name ">
            <h:outputText value="#{cas.caseName}" />
        </p:column>
        <p:column headerText="Case Detail">
            <h:outputText value="#{cas.caseDetail}" />
        </p:column>
        <p:column headerText="Action">
            <p:commandButton value="Accept Case" update=":form:TicketTable"></p:commandButton>
        </p:column>
    </p:dataTable>
    <p:dataTable id="TicketTable" var="ticket"
        value="#{beanCase.selectedCase.tickets}">
        <p:column headerText="Ticket Number">
            <h:outputText value="#{ticket.idTicket}" />
        </p:column>
        <p:column headerText="Ticket Details">
            <h:outputText value="#{ticket.labelTicket}" />
        </p:column>
        <p:column headerText="show">
            <h:outputText value="#{ticket.show}" />
        </p:column>
        <p:column headerText="this show is brought to you by">
            <h:outputText value="#{ticket.sponsor}" />
        </p:column>
        <p:column headerText="Make a Reservation">
            <p:commandButton value="Buy" action="#{beanCase.buyTicket()}">
                <f:setPropertyActionListener value="#{ticket}"
                    target="#{beanCase.selectedTicket}" />
            </p:commandButton>
        </p:column>
    </p:dataTable>
    

    before that you must create the data model classes for the Case and ticket

    public class CaseDataModel extends ListDataModel<Case> implements
        SelectableDataModel<Case> {
    CaseDAO caseDAO = new CaseDAO();
    
    public CaseDataModel() {
    }
    
    public CaseDataModel(List<Case> cases) {
        super(cases);
    }
    
    @Override
    public Case getRowData(String arg0) {
        List<Case> listOfMyObjet = (List<Case>) caseDAO.findAll();
        for (Case obj : listOfMyObjet) {
            if (String.valueOf(obj.getIdCase()).equals(arg0))
                ;
            return obj;
        }
        return null;
    }
    
    @Override
    public String getRowKey(Case arg0) {
        return String.valueOf(arg0.getIdCase());
    }
    

    }

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

Sidebar

Related Questions

I'm using JSF templates and Primefaces. Javascript code does not seem to be working
I am using PrimeFaces <p:dataTable> with pagination. I use <h:selectBooleancheckbox> with a Map property
I'm using Primefaces 3.3.1 and have question. I have p:commandButton inside p:column of p:dataTable.
I just started using PrimeFaces and cannot figure what is wrong with my code.
I have a inputTextarea that I refresh using PrimeFaces' AJAX poll. When the inputTextarea
I've been read this article : commandButton/commandLink/ajax action/listener method not invoked or input value
Can I send Ajax update commands to JSF components that have not been rendered
I am using Primefaces 3.3.1. My use case is very simple, after login user
I have a modal ConfirmDialog that is shown over a modal Dialog using PrimeFaces
How can I launch a dialog according to some conditions? I am using primefaces

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.