RowReorder example Horizontal snap

By default, when a row is dragged around a page with RowReorder, it will follow the mouse for both horizontal and vertical movements. However, you may wish to restrict the movement of the following row to just the vertical axis. This can be done with the rowReorder.snapX option.

This option can be used to fix the row to the table's left, or can be used to offset the row as is done in this example.

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

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

1
2
3
4
5
6
7
$(document).ready(function() {
    var table = $('#example').DataTable( {
        rowReorder: {
            snapX: 10
        }
    } );
} );

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