简体   繁体   中英

DataTables bootstrap pagination, checkboxes not getting added to all the rows

I am using bootstrap pagination in DataTable,first column contains checkboxes, default number of shown records is 10, when I change the the number of records only 10 checkboxes are displayed.

var oTable = $('.datatable').dataTable({
        aoColumnDefs  : [
{
    aTargets: [0],    // Column number which needs to be modified
    fnRender: function (o, v) {   // o, v contains the object and value for the column
        return '<input type="checkbox" class="cbox" value="hgh" style="opacity: 0;">';
    }
}],
        "sDom": "<'row-fluid'<'span6'l><'span6'f>r>t<'row-fluid'<'span12'i><'span12 center'p>>",
        "sPaginationType": "bootstrap",
        "oLanguage": {
        "sLengthMenu": "_MENU_ records per page"
        }
    } );

I think the problem is that "fnRender" function is called only one time when the table is generated. For solving this problem, handle changing row count in request and add checkboxes manually.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM