Adding buttons to Table veiw TV

Discussions related to customizing hooks. Hooks are documented at http://bigprof.com/appgini/help/advanced-topics/hooks/
Post Reply
nrobert
Posts: 6
Joined: 2020-09-08 13:08
Location: Blackpool, England
Contact:

Adding buttons to Table veiw TV

Post by nrobert » 2025-01-20 17:58

Hi all,

Hoping someone can help .......

I have added some custom buttons to my DB by using the code below, the last year/this year buttons are working correctly (in blue), however "Back to Order" (in Red) button is going back to the order but I am losing the current Filter I set.

let currentYear=new Date().getFullYear();
let lastYear=currentYear-1;

jQuery(function(){

jQuery('#Filter').after('<button class="btn btn-danger btn-lg"" type="button" id="filter-button"><i class="glyphicon glyphicon glyphicon-filter"></i> Last Year</button>');

jQuery('button[id=filter-button]').click(function(){

window.location = "payments_rcvd_view.php?SortField=2+asc%2C3&SortDirection=asc&FilterAnd%5B1%5D=and&FilterField%5B1%5D=10&FilterOperator%5B1%5D=greater-than-or-equal-to&FilterValue%5B1%5D=01%2F01%2F"+lastYear+"&FilterAnd%5B2%5D=and&FilterField%5B2%5D=10&FilterOperator%5B2%5D=less-than-or-equal-to&&FilterValue%5B2%5D=31%2F12%2F"+lastYear;
});

});

jQuery(function () {

jQuery('#Filter').after('<button class="btn btn-success btn-lg"" type="button" id="filter-button1"><i class="glyphicon glyphicon glyphicon-filter"></i> This Year</button>');

jQuery("button[id=filter-button1]").click(function (){
window.location = "payments_rcvd_view.php?SortField=2+asc%2C3&SortDirection=asc&FilterAnd%5B1%5D=and&FilterField%5B1%5D=10&FilterOperator%5B1%5D=greater-than-or-equal-to&FilterValue%5B1%5D=01%2F01%2F"+currentYear+"&FilterAnd%5B2%5D=and&FilterField%5B2%5D=10&FilterOperator%5B2%5D=less-than-or-equal-to&&FilterValue%5B2%5D=31%2F12%2F"+currentYear;

//"invoices_view.php?SortField=&SortDirection=&FilterAnd%5B1%5D=and&FilterField%5B1%5D=11&FilterOperator%5B1%5D=like&FilterValue%5B1%5D="+currentYear;

});

});


This is the part I need some help with it returns to the Order but losses the filters previously set.....

jQuery(function(){
jQuery('#Filter').after('<button class="btn btn-default" type="button" id="filter-button-ip"> Back to Order</button>');
jQuery('button[id=filter-button-ip]').click(function(){
window.location = 'https://towncentretrees.co.uk/TCT_Order ... s_view.php';
});
});

Post Reply