Hi all. I'm sorting a list of species, but sometimes the list is large and it takes several seconds to sort it. Thus, I tried adding a small notice to let our users know there's something running (and they should wait). Please just check this page: http://ibc.lynxeds.com/family/babblers-timaliidae And click on "Sort and Filter [+]". Then, click on any "Sort by" link.
With Opera, you will first get a message, then it starts sorting the species, then the message changes to a different text and that's all. With FF or IE, the first message isn't displayed, and you just know the CPU is doing some work, then the "Done!" message is shown and fades out.
So, in the worst case (slow CPU, large list), you might be waiting for 20 seconds and then you get that Done! message (it would be much better to show the "please wait" first, and just fade out when done...)
The JQuery code that calls the sort function is this:
$(".s_alf_eng").toggle(
function() {
$(".warning").text("Sorting... please wait").show(); //warning is an empty div
$('.media-status-specie li').sort(sortAscending1).appendTo('.media-status-specie');
$(".warning").text("Sorting... Done!").fadeOut(700);
},
function() {
$(".warning").text("Sorting... please wait").show();
$('.media-status-specie li').sort(sortDescending1).appendTo('.media-status-specie');
$(".warning").text("Sorting... Done!").fadeOut(700);
});
It works perfect in Opera. I don't understand why in the other browsers the first message is not shown.
What can I do to force FF and IE to display the "Please wait" message before starting the sort?
A related question is how to speed up the sorting (it can take up to 20 seconds for the largest family, in my core2duo...).
Thank you for any suggestion!
EDIT: The sort function is found here: stackoverflow.com/questions/1531176