Table works

This commit is contained in:
2024-10-09 15:13:40 +02:00
parent a4d0803d20
commit 4199b1c347
7 changed files with 183 additions and 47 deletions

View File

@ -0,0 +1,4 @@
.value_filter {
width: 150px;
}

View File

@ -0,0 +1,37 @@
function pagination_link(name, value){
let link_args = db_args;
if (name && value){
link_args[name] = value;
}
else if(name){
delete link_args[name];
}
return '?' + $.param( link_args );
}
$(".value_filter").change((e)=>{
window.location = pagination_link($(e.target).attr('name').substr('filter_'.length), $(e.target).val())
});
function enable_auto_refresh(){
setInterval( () => {
if($('#autoRefresh').prop('checked')){
$.get(
'/app/table/total' + pagination_link(),
(v) => {
if( v != db_total ){
window.location = pagination_link()
}
}
);
}
}, 1000);
sessionStorage.setItem('auto_refresh', $('#autoRefresh').prop('checked'));
}
$("#autoRefresh").click(enable_auto_refresh);
if(sessionStorage.hasOwnProperty('auto_refresh') && sessionStorage.getItem('auto_refresh') === 'true'){
$("#autoRefresh").prop('checked', true);
enable_auto_refresh()
}