Sorting row with ranking info

Sorting row with ranking info

ladlessladless Posts: 2Questions: 0Answers: 0
edited November 2012 in DataTables 1.9
Hello there,

I was wondering why my sorting isn't working as expected ("normal" sort):

Now I get:
8th
8th
7th
4th
3rd
2nd
22nd
20th

Instead I need to get:

22nd
20th
8th
7th
... you get the picture.

So far I have this code:
[code]if (TournamentManager.page_size != 0) {
$("table.tournamentmanager").each(function(i) {
var col = 0;
var dir = 'asc';

/* If the table has the attribute default_sort="2:desc" */
var default_sort = $(this).attr('default_sort');
if (default_sort != undefined) {
var val = default_sort.split(':');
col = val[0];
dir = val[1];
}
$(this).dataTable({
"iDisplayLength":TournamentManager.page_size,
"aaSorting": [[ col, dir]]
});
});
}[/code]
I tried some snippets but it doesn't work... Also did some research on the custom sorting plugins and it looks like they can do way much more than I need to. I'm sure there is a simpler approach to this.

Any help would be kindly appreciated !

Thanks.

Replies

  • ladlessladless Posts: 2Questions: 0Answers: 0
    I assume that this should be kind of "alphanumeric" sorting... no ?
  • allanallan Posts: 63,394Questions: 1Answers: 10,450 Site admin
    edited November 2012
    Agreed - you need to use a sorting plug-in. The formatted numbers plug-in might be the best option.

    Allan
This discussion has been closed.