Fix quick actions for alias table when pagination is true

master
andryyy 2017-04-27 09:49:04 +02:00
parent e26304f6d0
commit 68e67ba9b7
2 changed files with 77 additions and 66 deletions

View File

@ -32,3 +32,6 @@ table.footable>tbody>tr.footable-empty>td {
#alias_table { #alias_table {
cursor:pointer; cursor:pointer;
} }
#alias_table .footable-paging {
cursor: auto;
}

View File

@ -271,20 +271,34 @@ $(document).ready(function() {
"sorting": { "sorting": {
"enabled": true "enabled": true
} }
}, function aliases_table_hook() { });
var selected_aliases = {}; var selected_aliases = {};
$('input[name=sel_aliases]').change(function() {
$(document).on('click', 'tr', function(e) {
if (e.target.type == "checkbox") {
e.stopPropagation();
} else {
var $checkbox = $(this).find(':checkbox');
var checkbox = $(this).find(':checkbox');
checkbox.trigger('click');
}
});
$(document).on('change', 'input[name=sel_aliases]', function() {
selected_aliases = {}; selected_aliases = {};
$('input[name=sel_aliases]:checked').each(function(i) { $('input[name=sel_aliases]:checked').each(function(i) {
selected_aliases[i] = ($(this).val()); selected_aliases[i] = ($(this).val());
}); });
}); });
$("#select_all_aliases").click(function(e) {
$(document).on('click', '#select_all_aliases', function(e) {
e.preventDefault(); e.preventDefault();
var alias_chkbxs = $("input[name=sel_aliases]"); var alias_chkbxs = $("input[name=sel_aliases]:visible");
alias_chkbxs.prop("checked", !alias_chkbxs.prop("checked")).change(); alias_chkbxs.prop("checked", !alias_chkbxs.prop("checked")).change();
}); });
$("#activate_selected_alias").click(function(e) {
$(document).on('click', '#activate_selected_alias', function(e) {
e.preventDefault(); e.preventDefault();
if (Object.keys(selected_aliases).length !== 0) { if (Object.keys(selected_aliases).length !== 0) {
$.ajax({ $.ajax({
@ -299,7 +313,8 @@ $(document).ready(function() {
}); });
} }
}); });
$("#deactivate_selected_alias").click(function(e) {
$(document).on('click', '#deactivate_selected_alias', function(e) {
e.preventDefault(); e.preventDefault();
if (Object.keys(selected_aliases).length !== 0) { if (Object.keys(selected_aliases).length !== 0) {
$.ajax({ $.ajax({
@ -314,7 +329,8 @@ $(document).ready(function() {
}); });
} }
}); });
$("#delete_selected_alias").click(function(e) {
$(document).on('click', '#delete_selected_alias', function(e) {
e.preventDefault(); e.preventDefault();
if (Object.keys(selected_aliases).length !== 0) { if (Object.keys(selected_aliases).length !== 0) {
$.ajax({ $.ajax({
@ -329,16 +345,8 @@ $(document).ready(function() {
}); });
} }
}); });
$("tr").on('click',function(e) {
if (e.target.type == "checkbox") {
e.stopPropagation();
} else {
var $checkbox = $(this).find(':checkbox');
var checkbox = $(this).find(':checkbox');
checkbox.trigger('click');
}
});
});
} }
}); });
}); });