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

@@ -22,7 +22,7 @@ $header
</div>
</if>
<table class="bradius" id="sortable">
<table class="bradius" id="sortable" sort-column="1">
<thead>
<tr>
<th>

View File

@@ -22,7 +22,7 @@ $header
{$searchcode}
</div>
<table class="bradius" id="sortable">
<table class="bradius" id="sortable" sort-column="1">
<thead>
<tr>
<th>

View File

@@ -12,7 +12,7 @@
</if>
</td>
<td>
<a href="{$linker->getLink(array('section' => 'customers', 'page' => $page, 'action' => 'su', 'id' => $row['customerid']))}" rel="external">{$row['loginname']}</a>
<a href="{$linker->getLink(array('section' => 'customers', 'page' => $page, 'action' => 'su', 'sort' => $row['loginname'], 'id' => $row['customerid']))}" rel="external">{$row['loginname']}</a>
</td>
<td>
{$row['adminname']}

View File

@@ -22,7 +22,7 @@ $header
</div>
</if>
<table class="bradius" id="sortable">
<table class="bradius" id="sortable" sort-direction="desc">
<thead>
<tr>
<th>{$lng['logger']['date']}</th>

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

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) );

View File

@@ -26,7 +26,12 @@
<!--[if IE]><link rel="stylesheet" href="templates/{$theme}/css/main_ie.css" type="text/css" /><![endif]-->
<link href="css/jquery-ui.min.css" rel="stylesheet" type="text/css"/>
<script type="text/javascript" src="templates/{$theme}/assets/js/main.js"></script>
<script type="text/javascript" src="templates/{$theme}/assets/js/jquery.dataTables.js"></script>
<if $settings['panel']['natsorting'] == '0'>
<script type="text/javascript" src="templates/{$theme}/assets/js/jquery.dataTables.js"></script>
</if>
<if $settings['panel']['natsorting'] == '1'>
<script type="text/javascript" src="templates/{$theme}/assets/js/jquery.dataTables.naturalSorting.js"></script>
</if>
<link href="templates/{$theme}/assets/img/favicon.ico" rel="icon" type="image/x-icon" />
<title><if isset($userinfo['loginname']) && $userinfo['loginname'] != ''>{$userinfo['loginname']} - </if>Froxlor Server Management Panel</title>
<style type="text/css">