Additional Filter Buttons

The recommended method of customizing your AppGini-generated application is through hooks. But sometimes you might need to add functionality not accessible through hooks. You can discuss this here.
Post Reply
angus
Veteran Member
Posts: 128
Joined: 2020-05-28 22:27

Additional Filter Buttons

Post by angus » 2020-08-19 10:24

Hi everyone, I am wanting to add some filter buttons on the table view screen without the user having to set the filters. I also want to set this dynamically so it is based on the logged in user.

I have set up the -tv.js page ok And built the first button using the help from the forums but I need to add 2 additional conditions and everything i tried has not worked.

here is where the button is appearing
screenshot1.jpg
screenshot1.jpg (9.86 KiB) Viewed 2101 times
and here is the code below. I was able to get the [custom][0] field in the detail view ok, I copied over the code to the -tv.js file but it didnt work.

I need a filter that looks at field 21 and picks this up from the logged in user, and another filter (field 33) that is Europe

any help would be appreciated.

Code: Select all

$j(function() {
var d = new Date();

// formatted date .. change order and separator to the ones you selected in your AppGini project
// in the below line, the format is month/day/year
//var formattedDate = (d.getDate()+7) + '/' + (d.getMonth()+1) + '/' + d.getFullYear();
var formattedDate = '01/04/2021'

// now build the 4 parts of the filter
var filter = {
		'FilterAnd[1]': 'and',
        'FilterField[1]': 14,  // change this to the actual index of your date field
        'FilterOperator[1]': 'less-than',
        'FilterValue[1]': formattedDate
};

// building the filter url ... change tablename to the actual table name
var url = 'XXXXXXXXXXXXXXXXXXXXX_view.php?SortField=14&SortDirection=desc&' + $j.param(filter);

// finally, insert the filter button
$j('<a class="btn btn-lg btn-default" href="' + url + '">Due This Year</a>').appendTo('#top_buttons');
})
AppGini 22.13

Post Reply