rowReorder.snapX

Horizontal position control of the row being dragged. Please note - this property requires the RowReorder extension for DataTables.

Description

When RowReorder starts a drag, it clones the original target row and the clone is moved with the mouse, giving the end user visual feedback about the drag action.

By default the cloned row will be moved with the mouse both horizontally and vertically. However, only the virtual position is particularly important and it can be nice to lock the row to the host table vertically. This option provides that ability.

Types

boolean

Description:
  • true - the dragged row follows the mouse only vertically. It is locked to the left of the table horizontally.
  • false - the dragged row follows the mouse both horizontally and vertically

integer

Description:

Offset from the left of the table that the horizontal position is locked to. This can be a positive number (offset to the right) or a negative number (offset to the left).

Default

  • Value: false

Dragged row follows the mouse both horizontally and vertically

Examples

Fix the floating row to the table horizontally.:

$('#example').DataTable( {
	rowReorder: {
		snapX: true
	}
} );

Use a -5 pixel offset for the dragged row:

$('#example').DataTable( {
	rowReorder: {
		snapX: -5
	}
} );