darrachequesne / spring-data-jpa-datatables

Spring Data JPA extension to work with the great jQuery plugin DataTables (https://datatables.net/)
Apache License 2.0
447 stars 173 forks source link

Can you use datatables select extension? #70

Closed ergumayagay closed 6 years ago

ergumayagay commented 6 years ago

I've been trying to use select extension with checkbox can you provide me with example.

I have this warning DataTables warning: table id=items - Requested unknown parameter '4' for row 0, column 4. For more information about this error, please see http://datatables.net/tn/4

$(document).ready(function() {
    $('#items').DataTable( {
        "processing": true,
        "serverSide": true,
        "ajax":"/data/items",
        "select" :{
            style: "multi",
             selector: 'td:last-child'
        },
        columns:[
            {data : 'id'},
            {data: 'name'},
            {data: 'description'},
            {data: 'action',
                orderable : false,
                searchable: false,
                render: function(data, type,row){
                    return '<a href="/item/update/'+row.id+'">Update</a>'
                }
            },{
                className : "select-checkbox",
                orderable:false
            }

        ]
    } );
} );

Edit by owner: code format

darrachequesne commented 6 years ago

I think you're missing a searchable: false on your 4th column:

{
  className: "select-checkbox",
  orderable: false,
  searchable: false
}