RowReorder example Full row selection

The rowReorder.selector option provides the ability to define which element in a table row will provide the row reordering handle to the end user. This could be a button in an Actions column (which might also provide options for editing and deleting a row), or any other element.

By default only the first cell in the row will trigger the reordering action. This example shows the entire row being able to start the reorder. Simply click and drag anywhere on the row. Additionally, the column that defines the row order is hidden by default, making the table a simple orderable list.

NamePositionOfficeStart dateSalary
NamePositionOfficeStart dateSalary
Shou Itou Regional Marketing Tokyo 2011/08/14 $163,000
Tiger Nixon System Architect Edinburgh 2011/04/25 $320,800
Bruno Nash Software Engineer London 2011/05/03 $163,500
Olivia Liang Support Engineer Singapore 2011/02/03 $234,500
Gavin Joyce Developer Edinburgh 2010/12/22 $92,575
Ashton Cox Junior Technical Author San Francisco 2009/01/12 $86,000
Fiona Green Chief Operating Officer (COO) San Francisco 2010/03/11 $850,000
Martena Mccray Post-Sales support Edinburgh 2011/03/09 $324,050
Hermione Butler Regional Director London 2011/03/21 $356,250
Finn Camacho Support Engineer San Francisco 2009/07/07 $87,500
Showing 1 to 10 of 57 entries

The Javascript shown below is used to initialise the table shown in this example:

1
2
3
4
5
6
7
8
9
10
$(document).ready(function() {
    var table = $('#example').DataTable( {
        rowReorder: {
            selector: 'tr'
        },
        columnDefs: [
            { targets: 0, visible: false }
        ]
    } );
} );

In addition to the above code, the following Javascript library files are loaded for use in this example: