j(function() {
j("#example tbody").sortable({
opacity: 0.6,
cursor: 'move',
update: function(ev, ui) {
var oSettings = oTable.fnSettings();
var clonedData = oSettings.aoData.slice();
j('#example tbody tr').each(function(i)
{
var startPos = oTable.fnGetPosition(this);
// alert( "i: " + i + " startPos: " + startPos )
clonedData[i] = oSettings.aoData[startPos];
clonedData[i]._iId = i;
// App specific - first table col contains an incremental count which needs to be refreshed after a move
// Without cloning hack - do this with fnUpdate()
clonedData[i].nTr.cells[0].innerHTML = i+1;
clonedData[i].nTr.cells[0].innerText = i+1;
})
oSettings.aoData = clonedData;
oTable.fnDraw();
}});
});
It looks like you're new here. If you want to get involved, click one of these buttons!
Get useful and friendly help straight from the source.