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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 9, 20262026-06-09T04:21:58+00:00 2026-06-09T04:21:58+00:00

I have a column inside a <rich:dataTable> that contains <a4j:commandButton> for deleting rows. Deleting

  • 0

I have a column inside a <rich:dataTable> that contains <a4j:commandButton> for deleting rows.

Deleting rows works fine when calling bean’s delete function (e.g. #{bean.deleteCar(record.carId)}) via commandButton’s action attribute. Unfortunately, when using <a4j:jsFunction>‘s action attribute the record.carId of the last row is passed to the bean, instead of the selected row.

Some code for clarification. The following deletes the car of the clicked row:

<a4j:commandButton value="Delete"
                   action="#{bean.deleteCar(record.carId)}"/>

The following deletes last row’s car:

<a4j:commandButton value="Delete" 
                   onclick="#{rich:component('confirmDeletePane')}.show()">
    <a4j:jsFunction name="deleteCar" 
                    action="#{bean.deleteCar(record.carId)}"
                    oncomplete="#{rich:component('confirmDeletePane')}.hide();"
                    render="carsTable"/>
</a4j:commandButton>

<rich:popupPanel id="confirmDeletePane" header="Delete" modal="true" autosized="true" onmaskclick="#{rich:component('confirmDeletePane')}.hide();">
        <h:outputText value="Delete?"/>
        <h:panelGroup>
                <a4j:commandButton value="Cancel" onclick="#{rich:component('confirmDeletePane')}.hide(); return false;" />
                <a4j:commandButton value="OK" onclick="deleteCar(); return false;"/>
        </h:panelGroup>
    </rich:popupPanel>

As you can see I’m trying to confirm user’s selection before deletion.
Thanks in advance.

  • 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-09T04:22:00+00:00Added an answer on June 9, 2026 at 4:22 am

    As the showcase suggests, I concluded that a refined solution is to use indices for row selections. I’m copying here for future reference.

    The commandLink (calls confirmPane):

    <a4j:commandLink execute="@this"
                     render="@none"
                     oncomplete="#{rich:component('confirmPane')}.show()">
           <h:graphicImage value="/images/icons/delete.gif" alt="delete" />
           <a4j:param value="#{it.index}" assignTo="#{carsBean.currentCarIndex}" />
    </a4j:commandLink>
    

    The confirmPane (calls the JS function):

    <rich:popupPanel id="confirmPane" autosized="true">
            Delete?
            <a4j:commandButton value="Cancel" onclick="#{rich:component('confirmPane')}.hide(); return false;" />
            <a4j:commandButton value="Delete" onclick="remove(); return false;" />
    </rich:popupPanel>
    

    The jsFunction (calls Bean’s function):

    <a4j:jsFunction name="remove" action="#{carsBean.remove}" render="table" execute="@this"
            oncomplete="#{rich:component('confirmPane')}.hide();" />
    

    In the backing bean:

    private int currentCarIndex; // with the getter/setter
    
    public void remove() {
        // do your List removal (or DB transaction)
        // with the currentCarIndex
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm using Primefaces 3.3.1 and have question. I have p:commandButton inside p:column of p:dataTable.
How to filter DataView/DataTable by time? I have a table with datetime column inside
I have a data column that contains a substring similar to this: 'This is
I have a h:commandLink inside rich:dataTable . When I click on the command link,
I have deleted a column inside a table that is used to populate a
I have a primefaces datatable and inside the primefaces datatable, I have a column,
a have three column layout and i want to have three divs inside the
I have a grid. Inside the grid I have a column name as Document
I have a TemplateField column in a gridview with a button inside of it.
I have a radiobutton column in a gridview, inside many nested asp tables. I

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.