Hello! I have been having an issue for about 6 months where the add filter button option keeps showing back up on my app! Its absolutley crazy. Sometimes when I go into the settings to remove it, it’s even unchecked! but still showing on the page.
I have gone in and deleted them and a few days or a month later they re-appear, over and over
This is happening to me site-wide, meaning on pretty much every page of the app!
I have worked in detail with Knack and they simply have said they can’t figure it out
So, I am just wondering if anyone else is having this issue. Seems so bizarre to me
For the benefit of all readers, this is what you need to handle both issues, with just one …render.any function:
$(document).on('knack-view-render.any', function (event, view, data) {
//This is to remove the pagination
$('#' + view.key + ' .kn-pagination').remove();
//This is to solve the reappearing filters.
if (Knack.views[view.key] && !Knack.views[view.key].model.view.filter)
$('#' + view.key + ' .kn-filters-nav').remove();
})
Yes, you can combine both segments of code together!
Some user have reported that the problem where the Add filters button keep coming back actually happens in the Builder. I thought that this was in the App, but it’s not the case.
They set the view to Don’t allow records to be filtered but the setting reverts back by itself to Allow filtering after a few days.
So here’s another solution, less elegant, but still useful:
const removeFilters = ['view_xx', 'view_yy']; //Manually add all the problematic view IDs here.
$(document).on('knack-view-render.any', function (event, view, data) {
if (removeFilters.includes(view.key)) {
$('#' + view.key + ' .kn-filters-nav').remove();
$('.filterCtrlDiv').remove(); //For those using the KTL
}
})