When using default filter on a table and after displaying records, if
clicking "show all" it's ok for the first page, but not with the second page
displaying default filter records.
It seems impossible to go back suppressing default filter on navigating.
I got a response proposed by Ahmed Genedy :
Hi Jean,
Thanks a lot for the clarification. So, in essence, what we need to do here is to store some flag variable ‘apply_default_filters’ as true when the user first visits the page. Default filters then need to check that flag before being applied. And whenever the user clicks ‘Show all’, that flag should be set to false.
So, to set that flag as initially true, we need to check if the user is visiting the page from somewhere else (rather than interacting with the page):
Code: Select all
if(!count($_POST) && count($_GET) <= 1) {
// the above conditions usually indicate the user is arriving to the current table from another page
$_SESSION['apply_default_filters'] = true;
} elseif(!empty($_REQUEST['NoFilter_x'])) {
// the user clicked 'Show all', so let's suppress default filters
$_SESSION['apply_default_filters'] = false;
}
Code: Select all
if($_SESSION['apply_default_filters'] === true) {
// code for applying default filters
}
I tried this code and it runs correctly
Many thanks to Ahmed
Jean André BARGE