How do i check all checkbox in datatable when i click on "All" checkbox in table header?

select all checkbox jquery datatable pagination
datatable select all checkbox jsfiddle
datatable select all checkbox current page
datatables select all checkbox in header
check uncheck all checkbox jquery datatable
get all checked checkboxes jquery datatables
get all checked checkboxes jquery datatables from all pages
jquery datatable checkbox click event

I have implemented one example of data table. When i click on "all" checkbox in data table header its check and unchecked only once. Second time it not able to check all checkbox in table body. My code is following:

JSFIDDLE link click here

    <script src=""></script>
    <script type="text/javascript" src=""></script>
    <link href="" rel="stylesheet">

    <h1>DataTable Checkbox</h1>
    <table class="display dataTable" id="flow-table">
            <th class="check">
                <input type="checkbox" id="flowcheckall" value="">&nbsp;All</input>
            <!-- <th>Cookie</th> -->
    $(document).ready(function () {
        var str = "";
        for (i = 0; i < 25; i++) {
            a = i + 1;
            str += "<tr><td><input type='checkbox' id='checkall' name='mydata' value=" + a + "></td><td>a" + a + "</td><td>name" + a + "</td></tr>";
        $("#flow-table > tbody").append(str);
        oTableStaticFlow = $('#flow-table').dataTable({
           "aoColumnDefs": [{
                         'bSortable': false,
                         'aTargets': [0]

        $("#flowcheckall").click(function () {
            if (this.checked) {
                //$('input', oTable.fnGetNodes()).attr('checked',this.checked);
                $('#flow-table tbody input[type="checkbox"]').attr('checked', true);
            } else {
                $('#flow-table tbody input[type="checkbox"]').attr('checked', false);


Anybody help me..!

You can simply check/uncheck all checkboxes with this function:

  $("#flowcheckall").click(function () {
        $('#flow-table tbody input[type="checkbox"]').prop('checked', this.checked);


How do i check all checkbox in datatable when i click on "All , Provides solution to add a checkbox column and "select all" control to a table by jQuery DataTables plug-in and how to select/deselect all checkboxes using click on checkbox to set state of "Select all" control $('#example� DataTables Checkbox Check All Example. There are the Following The simple About DataTables Checkbox Check All Example Full Information With Example and source code.. As I will cover this Post with live Working example to develop jquery datatable multi select checkbox, so the datatables checkbox select all ajax for this example is following below.

Remove this js call

<script src=""></script>

I tested it and it worked fine after removing this. Reason must be because the other 2 you called are version 1.10.0-beta.1 and must have conflicted with the jquery-1.10.1.min.js you were calling.

jQuery DataTables: How to add a checkbox column, Gave it a try, and it works! $(".selectAll").on( "click", function(e) { if ($(this).is( ": checked� Normally jQuery datatable will display 10 records at a time. If we select using paging max it will show 100. If user needs to select all records form all pages. Below example I will show you how to select all records from all pages of jQuery datatable and same way if user unchecks select all checkbox it will uncheck checkboxes from all pages.

<input type='checkbox' class="sel_users" value='Anil'>Anil</option>
<input type='checkbox' class="sel_users" value='Amit'>Amit</option>
<input type='checkbox' class="sel_users" value='Mayank'>Mayank</option>
<input type='checkbox' class="sel_users" value='Sonarika'>Sonarika</option>
<input type='checkbox' class="sel_users" value='Vishal'>Vishal</option>
<input type='checkbox' class="sel_users" value='Yogesh'>Yogesh</option>

<input type='checkbox' id='checkallusers' class="checkallusers">Select All

    var checked = $(this).is(':checked'); 

    // Select all
       $('.sel_users').each(function() {
       // Deselect All
       $('.sel_users').each(function() {

Select All Checkbox using Select Extension — DataTables forums, A common option is to use a checkbox which can be clicked on to toggle row through the use of the select-checkbox CSS class for that column ( columns. I've implemented the multiple selection in the dataTable. The header checkbox is selecting and deselecting all items, but, it does not really select the rows. To select the rows I have to click on anywhere in the row but not in the checkbox. Do you have any idea why that is happening?

Checkbox selection, How to select all checkbox from datatable by one click. Posted 3 years ago by Crazylife. <th>{{ Form::checkbox('select_all' ,'1',false,array('id' => 'select-all'))� The checkbox is not an <input type="checkbox"> element, but rather a CSS that uses the :before and :after pseudo elements of the cell to draw a box and the tick. This can therefore be easily modified to suit the style of your site / app.

How to select all checkbox from datatable by one click, Normally jQuery datatable will display 10 records at a time. If we select using paging max it will show 100. If user needs to select all records� I have a button on the same form the data grid view is on that I want to use to update the checkboxes in a particular column. For example, once the user filters the data grid view I want to click the button and all the rows visible will be checked (or set to True).

How to select all checkboxes from all pages in jQuery datatable grid?, Because this will work when you click on checkbox. So Disable the first column sorting with below code. $('#example').dataTable( {. "columnDefs� var data = table.$('input[type="checkbox"]').serialize(); For more information on submitting the form elements in a table powered by jQuery DataTables, please see jQuery DataTables: How to submit all pages form data. Server-side processing. Please note that the example and code above will work for client-side processing mode only.

  • When answering an old question, your answer would be much more useful to other StackOverflow users if you included some context to explain how your answer helps, particularly for a question that already has an accepted answer. See: How do I write a good answer.