pagination without reload while keeping filters applied (#521)

This commit is contained in:
Kevin Papst
2019-01-23 18:48:17 +01:00
committed by GitHub
parent 572f01ed74
commit 55d8bc9ba5
22 changed files with 60 additions and 38 deletions

View File

@@ -33,7 +33,7 @@ $(function() {
moment.locale($.kimai.settings['locale']);
// ask before a delete call is executed
$('a.btn-trash').click(function (event) {
$('body').on('click', 'a.btn-trash', function (event) {
return confirm($.kimai.settings['confirmDelete']);
});
@@ -125,16 +125,6 @@ $(function() {
}, function(){
$(this).find('a.anchor').hide();
});
/*
$('input').iCheck({
checkboxClass: 'icheckbox_square-blue',
radioClass: 'iradio_square-blue',
increaseArea: '20%' // optional
});
*/
// $.AdminLTE.pushMenu.expandOnHover();
},
pauseRecord: function(selector) {
$(selector + ' .pull-left i').hover(function () {

View File

@@ -6,23 +6,31 @@
*/
$(document).ready(function () {
/* Submit the pagination including the toolbar filters */
$('body').on('click', 'div.navigation ul.pagination li a', function(event) {
var $pager = $(".toolbar form input[name='page']");
if ($pager.length === 0) {
return;
}
event.preventDefault();
event.stopPropagation();
var $urlParts = $(this).attr('href').split('/');
var page = $urlParts[$urlParts.length-1];
$pager.val(page);
$pager.trigger('change');
return false;
});
$('.toolbar form input').change(function (event) {
toolbarLoadDataAfterChange();
});
$('.toolbar form select').change(function (event) {
switch (event.target.id) {
case 'customer':
$('.toolbar form select#project').val('');
if ($('.toolbar form select#activity').find(':selected').attr('data-project')) {
$('.toolbar form select#activity').val('');
}
break;
case 'project':
if ($('.toolbar form select#activity').find(':selected').attr('data-project')) {
$('.toolbar form select#activity').val('');
}
case 'page':
break;
default:
$('.toolbar form input#page').val(1);
}
toolbarLoadDataAfterChange();
});

View File

@@ -222,3 +222,15 @@ div.dataTables_scrollHead table.table-bordered {
.table-striped.dataTable tbody tr.active:nth-child(odd) th {
background-color: #017ebc;
}
/*
Make sure that the action buttons do not line-break if another column takes all available space
See https://github.com/twbs/bootstrap/issues/9939#issuecomment-37682952
*/
table.dataTable {
td {
.btn-group {
display: flex;
}
}
}