Created
June 19, 2013 21:34
-
-
Save ljepson/5818311 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function sort(a,b) { | |
var first = a.substr(0).charCodeAt(); | |
var second = b.substr(0).charCodeAt(); | |
if(!first || first < second || first === second) return false; | |
return true; | |
} | |
function check_status() { | |
var status_text = $('.span6:first').find('.status'); | |
var run_again = 0; | |
for(var n = 0; n < status_text.length; n++) { | |
var sort_result = sort($(status_text[n-1]).text(),$(status_text[n]).text()); | |
if(sort_result) { | |
run_again = 1; | |
$(status_text[n-1]).closest('tr').before($(status_text[n]).closest('tr')); | |
break; | |
} | |
} | |
if(run_again) check_status(); | |
} | |
$('th:contains("Status")').on('click',check_status); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment