I've been implementing drag and drop table row functionality so as to set row order display. It all works fine with a jquery script.
In the rows there is a column showing the row order number (e.g 1 at top, 2 second etc)
So when I drag and drop the rows I have a messy thing to update the row numbering shown on screen.
There must be a cleaner way to do this I think??
onDrop: function(table, row) {
var ajxa=$.tableDnD.serialize();
var myarr = ajxa.split("&");
var num=1;
$.each(myarr, function(i,v) {
var nv = v.split("=");
if(nv[1]>=1){
$('#ord'+nv[1]).html(num);
++num;
}
});
}
var ajxa=$.tableDnD.serialize();
gets the new row order into ajxa and I then do my messy string splits on it to get relevant data
$('#ord'+nv[1]) is id of the cell I am updating
this is a sample of ajxa:
dragtable[]=&dragtable[]=&dragtable[]=74&dragtable[]=13&dragtable[]=11&dragtable[]=1&dragtable[]=14&dragtable[]=12
Each item is a table row, the empty ones are the irrelevant header rows
or is this ok?