Added natural dynamic sorting

New attributes for sortable tables: sort-column (0 ... x) for default
sort col in template and sort-direction (asc, desc) for default sort
order on load
This commit is contained in:
BNoiZe
2013-10-06 09:43:01 +02:00
parent 718c19f230
commit 6af5608f0f
8 changed files with 24250 additions and 153 deletions

View File

@@ -21,13 +21,19 @@ $(document).ready(function() {
});
// Enable datatable
$('#sortable').dataTable({
var sortColumn = $('#sortable').attr('sort-column');
if (sortColumn == null) { sortColumn = "0"; }
var sortDirection = $('#sortable').attr('sort-direction');
if (sortDirection == null) { sortDirection = "asc"; }
var sortTable = $('#sortable').dataTable({
"bFilter": false,
"bInfo": false,
"bPaginate": false
"bPaginate": false,
"aaSorting": [[sortColumn, sortDirection]]
});
$('.nosort').unbind('click');
// this is necessary for the special setting feature (ref #1010)
$.getQueryVariable = function(key) {
var urlParams = decodeURI( window.location.search.substring(1) );