I have a column within which are multiple 'records' (each a div). Each record has a bunch of fields (each a span whose id is the fieldname).
I want to allow the user to sort all the records based on a field. I also want, the field that has been sorted to be moved to the beginning of the record. So I came up with this. But its really slow for a large sets. Not sure whats the best way to do this. Any ideas?
$(".col1 div").sort(
function (a,b)
{
if($(a).children("."+field).text() > $(b).children("."+field).text())
return -1;
else
return 1;
}).appendTo(".col1");