UI: implemented saimod_table_config sort

This commit is contained in:
Messerbill 2015-06-08 18:49:25 +02:00
parent a36abc2f1b
commit 981f42ea8a
4 changed files with 24 additions and 43 deletions

View File

@ -1,49 +1,30 @@
function init_saimod_sys_config() { function init_saimod_sys_config() {
$('#tabs_config a').click(function (e) { saimod_config_tablesort("sai_mod_table_basics");
$('#tabs_config li').each(function(){
$(this).removeClass('active');});
$(this).parent().addClass('active');
});
} }
function init_saimod_sys_config_basics() { function init_saimod_sys_config_basics() {
$('#tabs_config li').each(function(){ $('#tabs_config li').each(function(){
$(this).removeClass('active');}); $(this).removeClass('active');});
$('#menu_tag_basics').parent().addClass('active'); $('#menu_tag_basics').parent().addClass('active');
saimod_config_tablesort("sai_mod_table_basics");
} }
function init_saimod_sys_config_database() { function init_saimod_sys_config_database() {
$('#tabs_config li').each(function(){ $('#tabs_config li').each(function(){
$(this).removeClass('active');}); $(this).removeClass('active');});
$('#menu_tag_database').parent().addClass('active'); $('#menu_tag_database').parent().addClass('active');
saimod_config_tablesort("sai_mod_table_database");
} }
function init_saimod_sys_config_sai() { function init_saimod_sys_config_sai() {
$('#tabs_config li').each(function(){ $('#tabs_config li').each(function(){
$(this).removeClass('active');}); $(this).removeClass('active');});
$('#menu_tag_sai').parent().addClass('active'); $('#menu_tag_sai').parent().addClass('active');
saimod_config_tablesort("sai_mod_table_sai");
} }
function config_menu(){ function saimod_config_tablesort(id){
$('#tabs_config li').each(function(){ var table_basics = document.getElementById(id);
$(this).removeClass('active');}); var sort = new Tablesort(table_basics, {descending: true});
if($('#menu_tag__'+system.cur_state().split('.')[1]).length){ sort.refresh();
$('#menu_tag__'+system.cur_state().split('.')[1]).parent().addClass('active'); }
} else {
$('menu_tag_basics').parent().addClass('active');}
}
/*
var table_basics = document.getElementById('sai_mod_config_table_basics');
var sort = new Tablesort(table_basics);
function sort_table(){
console.log("testme");
}
table_basics.addEventListener('beforeSort', function() {
alert('Table is about to be sorted!');
});
table_basics.addEventListener('afterSort', function() {
alert('Table sorted!');
});*/

View File

@ -1,8 +1,8 @@
<table class="table sai_table"> <table class="table sai_table" id="sai_mod_table_basics">
<tr class="no-select"> <tr class="no-sort">
<th>ID</th> <th>ID <span class="glyphicon glyphicon-sort" aria-hidden="true"></span></th>
<th>Name</th> <th>Name <span class="glyphicon glyphicon-sort" aria-hidden="true"></span></th>
<th>Value</th> <th>Value <span class="glyphicon glyphicon-sort" aria-hidden="true"></span></th>
</tr> </tr>
${basics} ${basics}
</table> </table>

View File

@ -1,8 +1,8 @@
<table class="table sai_table"> <table class="table sai_table" id="sai_mod_table_database">
<tr class="no-select"> <tr class="no-sort">
<th>ID</th> <th>ID <span class="glyphicon glyphicon-sort" aria-hidden="true"></span></th>
<th>Name</th> <th>Name <span class="glyphicon glyphicon-sort" aria-hidden="true"></span></th>
<th>Value</th> <th>Value <span class="glyphicon glyphicon-sort" aria-hidden="true"></span></th>
</tr> </tr>
${database} ${database}
</table> </table>

View File

@ -1,8 +1,8 @@
<table class="table sai_table"> <table class="table sai_table" id="sai_mod_table_sai">
<tr class="no-select"> <tr class="no-sort">
<th>ID</th> <th>ID <span class="glyphicon glyphicon-sort" aria-hidden="true"></span></th>
<th>Name</th> <th>Name <span class="glyphicon glyphicon-sort" aria-hidden="true"></span></th>
<th>Value</th> <th>Value <span class="glyphicon glyphicon-sort" aria-hidden="true"></span></th>
</tr> </tr>
${sai} ${sai}
</table> </table>