Skip to content

Infragistics Community Forum / Web / Ignite UI for jQuery / Check/Uncheck Select All header checkbox using jquery

Check/Uncheck Select All header checkbox using jquery

New Discussion
Adhikar Patil
Adhikar Patil asked on Sep 26, 2019 7:09 AM

Hi,

i wanted to check or uncheck  SelectAll header checkbox on specific condition. so how can i check do that programmatically.

I found some workaround to do it programmatically.

$(‘#ig1’).find(‘[name=”hchk”]’).data(“chk”,”off”).find(“span”).removeClass( “ui-igcheckbox-normal-off” ).addClass( “ui-igcheckbox-normal-off” );

 

but above work around fail when checkbox clicked and checked previously and using above code i unchecked it and then clicked to checked that time it actually perform deselection of rows but it must perform Selection of all rows.

Sign In to post a reply

Replies

  • 0
    Vasil Pavlov
    Vasil Pavlov answered on Apr 2, 2018 4:02 PM

    Hello Adhikar,

     

    Thank you for posting in our forum.

    Please check the attached sample: I initialize a grid that has a checkbox in the first column header – it toggles the checkboxes for the whole column. There is a grid option "renderCheckboxes" which I have set to "true" – it renders checkboxes for every boolean column automatically. As some customization is required, here is what I do:

    • On the grid’s “rendered” event, I attach a “click” event handler to the column header that contains the “select all” checkbox.
    • When the user clicks the header checkbox, I check if it has the CSS class “.ui-igcheckbox-small-off” and toggle it by using jQuery’s addClass and removeClass methods.
    • After that I iterate the data source to set the “Available” property of every record to “false”/”true” accordingly.
    • Finally, I call the grid’s “dataBind” method in order to update the UI

    If you have any further questions regarding this matter, or you need any additional assistance, feel free to contact me.

  • 0
    rahul kumar
    rahul kumar answered on Sep 26, 2019 7:09 AM

    jQuery is() method is to check the current matched set of elements against a selector, element, or jQuery object and return true if at least one of these elements matches the given arguments. If no element fits, or the selector is not valid, then the response will be 'false'. This method traverses along the DOM elements to find a match, which satisfies the passed parameter.

    if ($("input[type=checkbox]").is(":checked")) {
    alert("Checked");
    }

  • You must be logged in to reply to this topic.
Discussion created by
Favorites
Replies
Created On
Last Post
Discussion created by
Adhikar Patil
Favorites
0
Replies
2
Created On
Sep 26, 2019
Last Post
6 years, 5 months ago

Suggested Discussions

Created by

Created on

Sep 26, 2019 7:09 AM

Last activity on

Feb 23, 2026 10:22 AM