From c6df9ebca013e410c8a23eb12130fa1e88d51d98 Mon Sep 17 00:00:00 2001 From: Brian Miyaji Date: Thu, 9 Jan 2014 16:15:15 +1100 Subject: [PATCH] Make number column sortable ascending only --- assets/css/sportspress.css | 10 +++++++++- assets/js/sportspress.js | 26 +++++++++++++------------- 2 files changed, 22 insertions(+), 14 deletions(-) diff --git a/assets/css/sportspress.css b/assets/css/sportspress.css index 3f136840..70867c97 100644 --- a/assets/css/sportspress.css +++ b/assets/css/sportspress.css @@ -3,7 +3,9 @@ /* Data Tables */ .sp-data-table thead .sorting, .sp-data-table thead .sorting_asc, -.sp-data-table thead .sorting_desc { +.sp-data-table thead .sorting_desc, +.sp-data-table thead .sorting_asc_disabled, +.sp-data-table thead .sorting_desc_disabled { cursor: pointer; } .sp-data-table .sorting:after, @@ -21,6 +23,12 @@ .sp-data-table .sorting_desc:after { content: "\f140"; } +.sp-data-table .column-number.sorting_asc { + cursor: default; +} +.sp-data-table .column-number:after { + content: ""; +} .sp-data-table .column-name .logo { vertical-align: middle; height: 2em; diff --git a/assets/js/sportspress.js b/assets/js/sportspress.js index 9ad31423..faf17346 100644 --- a/assets/js/sportspress.js +++ b/assets/js/sportspress.js @@ -1,21 +1,21 @@ (function($) { // Data tables - $('.sp-data-table').dataTable({ - 'aaSorting': [], - 'bAutoWidth': false, - 'bFilter': false, - 'bInfo': false, - 'bPaginate': false, - 'bSort': true, - 'oLanguage': { - 'oAria': { - 'sSortAscending': '', - 'sSortDescending': '' + $(".sp-data-table").dataTable({ + "aaSorting": [], + "bAutoWidth": false, + "bFilter": false, + "bInfo": false, + "bPaginate": false, + "bSort": true, + "oLanguage": { + "oAria": { + "sSortAscending": "", + "sSortDescending": "" } }, - 'aoColumnDefs': [ - { 'bSortable': false, 'aTargets': [ 0 ] } + "aoColumnDefs": [ + { "asSorting": [ "asc" ], "aTargets": [ 0 ] } ] });