Quantcast
Channel: Recent Discussions — DataTables forums
Viewing all articles
Browse latest Browse all 82034

Sorting row with ranking info

$
0
0
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:
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]]
			});
		});
	}
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.

Viewing all articles
Browse latest Browse all 82034

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>