views:

218

answers:

2

I got a table which uses jQuery UI's sortable. The first column contains the order number of each row. How do I automatically sort the numbers (in ascending order) in the first column when I sort the rows? This means that only the numbers in the first column will be sorted.

Thanks in advance!

+2  A: 
var position = 1;

$('table tbody tr').each(function () {
    $('td:first', $(this)).text(position);
    position += 1;
});

You can put this function that occurs when sorting is done (it's "stop" for sortables UI)

Deniss Kozlovs
nice solution!thanks!
baker
A: 

hey check out this...

http://stackoverflow.com/questions/1886306/how-do-we-prevent-default-actions-in-javascript

bala3569
How is this related?
fudgey