Explicitly show column on active filter using text separated with commas

Discussions related to customizing hooks. Hooks are documented at http://bigprof.com/appgini/help/advanced-topics/hooks/
Post Reply
sacgtdev
Veteran Member
Posts: 80
Joined: 2020-06-10 11:14

Explicitly show column on active filter using text separated with commas

Post by sacgtdev » 2024-06-18 08:55

The following work fine to color filter button when filter applied:

https://forums.appgini.com/phpbb/viewto ... r_x#p21224

However, I am looking for a way to explicit show in text on what columns is being filtered.

Is there a workarounds to create a inline text showing actively-filtered columns, separated with commas?

The closest that I can get to, is using the following code at footer-extras.php. It returns Filter 01, Filter 02,etc..
<div id="filter-container"></div>
<script>
$j(() => {
const filterFields = $j('[name^=FilterField]');
const filtersApplied = filterFields.filter(function() {
return $j(this).val() !== '';
});

if (filtersApplied.length > 0) {
const filterNames = filtersApplied.map(function() {
return $j(this).attr('name');
}).get().join(', ');

$j('#filter-status').text(`Filters applied to: ${filterNames}`);
} else {
$j('#filter-status').text('No filters applied.');
}
});
</script>

sacgtdev
Veteran Member
Posts: 80
Joined: 2020-06-10 11:14

Re: Explicitly show column on active filter using text separated with commas

Post by sacgtdev » 2024-06-28 00:05

Any ideas on how to make the code works?

Post Reply