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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 28, 20262026-05-28T05:15:24+00:00 2026-05-28T05:15:24+00:00

I am trying to implement a Select All checkbox using primefaces component p:selectBooleanCheckbox and

  • 0

I am trying to implement a Select All checkbox using primefaces component p:selectBooleanCheckbox and jquery.

Here is my code:

<p:selectBooleanCheckbox id="selectAll" onchange="selectAll(this);" itemLabel="select all"/><br/><br/>
<p:selectBooleanCheckbox id="test1" itemLabel="test1"/><br/>
<p:selectBooleanCheckbox id="test2" itemLabel="test2"/><br/>
<p:selectBooleanCheckbox id="test3" itemLabel="test3"/><br/>
<p:selectBooleanCheckbox id="test4" itemLabel="test4"/><br/>
<input type="checkbox" id="test5">test5</input><br/>
<input type="checkbox" id="test6">test6</input><br/>
<input type="checkbox" id="test7">test7</input><br/>

And the selectAll javascript function:

function selectAll(checkAll) {
    var checked = checkAll.checked;      
    $(':checkbox[id*="test"]').attr('checked', checked);
}

When I select the selectAll checkbox, only checkboxes 5,6 and 7 are checked.
Using WebDeveloper I could verify the generated code and it seems that the other checkboxes are also checked (checked = “checked”), although they are not displayed checked.

I also tried:

function selectAll(checkAll) {
    var checked = checkAll.checked;                  
    $(':checkbox[id*="test"]').click();
}

And it did not work.

I only added those HTML checkboxes to test my jquery. Just to make sure it was working.

I am using Primefaces 3.0 and Tomcat 6.0.20.

Can anyone help me? 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-05-28T05:15:25+00:00Added an answer on May 28, 2026 at 5:15 am

    The problem was with the style classes primefaces uses, once the checkbox itself was being checked.

    To solve it I had to change the javascript function. Now it looks like this:

    function selectAll(checkAll) {
        var checked = checkAll.checked; 
    
        //to change the checked attribute                
        $(':checkbox[id*="test"]').attr('checked', checked);
    
        if (checked) {
            $('div[id*="test"] > div').each(function() {
                $(this).addClass('ui-state-active');
                $(this).children('span').addClass('ui-icon ui-icon-check');
            });
        } else {
            $('div[id*="test"] > div').each(function() {
                $(this).removeClass('ui-state-active');
                $(this).children('span').removeClass('ui-icon ui-icon-check');
            });
        }
    }
    

    It was all a matter of displaying the selection of the checkbox. And in this case, as I was using primefaces, it was all a matter of styles.

    Thanks for those who tried to help me.

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

Sidebar

Related Questions

trying to implement a dialog-box style behaviour using a separate div section with all
In the below code i am trying to implement the selectall functionality.when i clcik
I'm trying to implement this method of making a nice form upload: www.kavoir.com/2009/02/styling-file-upload-select-input-control-input-typefile.html/ which
I am trying to implement the jquery selectbox script. I have made all the
I'm trying to implement a Select All menu item for a ListView in a
I am currently trying to implement an algorithm to select a unique (16-bit) identifier.
All I am currently trying implement something along the lines of dim l_stuff as
I am trying to implement a multi-tenant application, that is - data of all
I am trying to Implement a JFileChooser that allows a user to select files
I am trying to implement a Codeigniter based app on Android via phonegap, all

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.