Closed vnguyen13 closed 12 years ago
In place of this:
return $.text([a]) > $.text([b]) ?
inverse ? -1 : 1
: inverse ? 1 : -1;
Try this:
var textA = $.text([a]);
var textB = $.text([b]);
if (textA == '--') textA = 100;
if (textB == '--') textB = 100;
return textA > textB ?
inverse ? -1 : 1
: inverse ? 1 : -1;
Thanks so much for putting me in the right direction!
I got it to work with a really small change to yours:
var textA = $.text([a]);
var textB = $.text([b]);
if (textA.indexOf("--") != -1) textA = "";
if (textB.indexOf("--") != -1) textB = "";
return textA > textB ?
inverse ? -1 : 1
: inverse ? 1 : -1;
I realized having nothing worked better than using 100%.
Cool, glad it works!
First, thanks for creating this. It's really great. I was wondering if there was a way to ignore values like "--" in a table I'm sorting. Right now the table cells list grades in percentages (99%, 80%, 60%, etc). But for the students that haven't taken the quizzes yet, it displays "--". The sorter uses it as being "higher" than 100%. I want -- to act as if it were a 0.
Right now I have: