Drag and Drop Datatables
Demonstrate a bug in datatables RowReorder plugin that prevents the rows from staying in their position after dropping
HTML
<link rel="stylesheet" href="https://cdn.datatables.net/r/dt/jq-2.1.4,dt-1.10.9,cr-1.2.0,fc-3.1.0,fh-3.0.0,r-1.0.7,rr-1.0.0,sc-1.3.0/datatables.min.css">
<script src="https://cdn.datatables.net/r/dt/jq-2.1.4,dt-1.10.9,cr-1.2.0,fc-3.1.0,fh-3.0.0,r-1.0.7,rr-1.0.0,sc-1.3.0/datatables.min.js"></script>
<script src="https://cdn.datatables.net/plug-ins/1.10.9/api/order.neutral().js"></script>
<button id="res" type="button">reset order</button>
<table id="ConfigMenuTable" class="display" width="100%" cellspacing="0"></table>
JavaScript
var table;
$(document).ready(function() {
var testData = [{
Widget: "AnzahlTermine",
Label: "Termine",
Icon: "fa fa-clock-o fa-5x",
positionX: "1",
positionY: "1",
id: "163"
}, {
Widget: "Abwesenheit",
Label: "Abwesenheit",
Icon: "fa fa-stethoscope fa-5x",
positionX: "1",
positionY: "2",
id: "166"
}, {
Widget: "Terminerinnerung",
Label: "SMS",
Icon: "fa fa-mobile fa-5x",
positionX: "1",
positionY: "3",
id: "167"
}, {
Widget: "Pflegepakete",
Label: "Pflegepakete",
Icon: "fa fa-tag fa-5x",
positionX: "1",
positionY: "4",
id: "168"
}, {
Widget: "Fertigstellungsstatus",
Label: "Status",
Icon: "fa fa-forward fa-5x",
positionX: "1",
positionY: "5",
id: "169"
}, {
Widget: "Werkstattteams",
Label: "Werkstatt-Teams",
Icon: "fa fa-wrench fa-5x",
positionX: "1",
positionY: "6",
id: "165"
}, {
Widget: "Werkstattleistung",
Label: "Werkstattleistung",
Icon: "fa fa-tachometer fa-5x",
positionX: "1",
positionY: "7",
id: "170"
}, {
Widget: "Radwechsel",
Label: "Radwechsel",
Icon: "fa fa-circle fa-5x",
positionX: "1",
positionY: "8",
id: "171"
}, {
Widget: "AnzahlErsatzfahrzeuge",
Label: "Mobilität",
Icon: "fa fa-taxi fa-5x",
positionX: "1",
positionY: "9",
id: "164"
}]
table = $('#ConfigMenuTable').DataTable({
data: testData,
columns: [{
data: 'positionX',
}, {
data: 'Label'
}, {
data: 'id'
}, {
data: 'positionY',
}],
rowReorder: true
});
});