3

Hi i'm using datatables from datatables.net, everything was working well until i tried to add checkboxes to my table. I'm using table-tools, with column filtering and show/hide column. I added the checkboxes which work across all pages in the pagination however when i submit the form it only sends the data for the checkboxes displayed on the current page. How can i somehow store all the checkboxes that have been checked even if they're on other pages within the table. I'm not a Js man so i really have know idea. i need to be able to store the id for each user who was checked in the check[].

Thanks for any help :)

It's a foreach loop generating the data and the checkboxes are:

<td><input name="check[]" type="checkbox" value="{{ $staff->id }}" /> </td>

The Jquery code is:

 var asInitVals = new Array();

$(document).ready(function() {

    /*
     * Support functions to provide a little bit of 'user friendlyness' to the textboxes in
     * the footer
     */
    jQuery("tfoot input").each( function (i) {
        asInitVals[this.name] = this.value;
    } );

    jQuery("tfoot input").focus( function () {
        if ( this.className == "search_init" )
        {
            this.className = "";
            this.value = "";
        }
    } );

    jQuery("tfoot input").blur( function (i) {
        if ( this.value == "" )
        {
            this.className = "search_init";
            this.value = asInitVals[this.name];
        }
    } );

    var oTable = $('.data-tbl-tools').dataTable( {
        "sPaginationType": "full_numbers",
        "iDisplayLength": 10,
        "oLanguage": {
            "sSearch": "Search all columns:"
        },
        "sDom": '<"tbl-tools-searchbox"fl<"clear">>,<"tbl_tools"CT<"clear">>,<"table_content"t>,<"widget-bottom"p<"clear">>',
        "oTableTools": {
        "sSwfPath": "../swf/copy_cvs_xls_pdf.swf"
        }

    } );

    $("tfoot input").keyup( function () {
    var id = $(this).attr('id').split("-")[1];
    oTable.fnFilter( this.value, id );
    });

} );
4

0 回答 0