Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

DataTables: shift multi-select not working

I am using datatable 1.10. I have already create a table, but I can't manage to do the multiple "shift select" on its rows.

According to the DataTables doc:

TableTools has four row selection modes of operation:
    none - Default, where no user row selection options are available
    single - A single row can be selected
    multi - Multiple rows can be selected simply by clicking on the rows
    os - Operating System like selection where you can use the shift and ctrl / cmd keys on your keyboard to add / remove rows from the selection.

So I create my table as follows:

$("#my-table-div").DataTable({
    "retrieve": true,
    "pagingType": "full_numbers",
    "pageLength": 50,
    "lengthMenu": [50, 100, 200],
    "dom": '<lfi<t>p>',
    "autoWidth": false,
    "columns": columnsTable,
    "tableTools": {
        "sRowSelect": "os"
    }
});

As you can see, I'm using "sRowSelect": "os", but it is certainly not working as I desire. I can't get the "shift select" to work.

Any ideas on what I'm missing or doing wrong?

like image 336
Xar Avatar asked Mar 16 '26 15:03

Xar


1 Answers

Here is a live example, you need to add dataTables.select.min.js ressource to manage the select option. And your option : "columns": columnsTable is problematic.

$(document).ready(function() {
    $('#example').DataTable( {
        "retrieve": true,
        "pagingType": "full_numbers",
        "pageLength": 50,
        "lengthMenu": [50, 100, 200],
        "dom": '<lfi<t>p>',
        "autoWidth": false,
        //"columns": columnsTable, <-- options problem
        "select": {
            "style": "os"
        }
    } );
} );
like image 75
Peacefull Avatar answered Mar 19 '26 03:03

Peacefull



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!