How to keep refined filters set

Hi all,
How to keep refined filters set when returning to the grid from a form linked to grid rows.
I got a grid with several refined search fields.
The user usually set filters and then he goes to navigate grid.
I got the possibility to link the related form clicking on action bar button or with html field.
On form, once edited or confirmed, I got a button to go back with classical sc_redir(grid).
When you come back the grid refreshes all and I lost all refined filter previously set.
How can avoid this behavior ?? Thanks

You can save the current where and use it when you access the grid again

in your grid
onScriptInit

if (!empty([last_where])) {
  	$Where_Current = {sc_where_current};

    //Remove current where from last_where so only the new filters will be reinjected
 	$Where_Add = str_replace($Where_Current, "", [last_where]);

  	sc_select_where(add) = urldecode($Where_Add);
  	[last_where] = '';
  }

onRecord

[current_where] = {sc_where_current};


in your form
onScriptInit

[last_where] = [current_where];


in you menu, just to be safe
onExecute

 [last_where] = '';
 [current_where] = '';
1 Like