0

Using the following code

$filter = 'foo=1&bar=2';
$filter = base64_encode($filter);
$url = Mage::helper('adminhtml')->getUrl('adminhtml/moo/index', array('filter'=>$filter));

The URL stored in the $url var would thus link to the moo grid, with foo filtered to 1 & bar filtered to 2.

By default, foo is filtered to 0 and bar is filtered to 0 as well.

After accessing the $url, the grid will keep loading with your newly applied filters (foo = 1 and bar = 2) until you restart your admin session. Is it somehow possible to force Magento not to do this? I.E.

$filter = 'foo=1&bar=2&DoNotRemember=1';
$filter = base64_encode($filter);
$url = Mage::helper('adminhtml')->getUrl('adminhtml/moo/index', array('filter'=>$filter));

1 Answer 1

2

Edit your grid class and add this in the constructor:

$this->setSaveParametersInSession(false);
4
  • At some point I'm going to need to start splitting my salary with you.
    – Moose
    Oct 21, 2015 at 12:01
  • the sooner the better :)
    – Marius
    Oct 21, 2015 at 12:09
  • Interestingly enough, this does seem to resolve manual filters applied. But after clicking the link to the $url set as mentioned above, it seems to save the parameters, even though the flag is set to false. Going to keep digging.
    – Moose
    Oct 21, 2015 at 14:30
  • Ah man, this does look troubling. Manually applying filters after setting saveParametersInSession(false); works as expected, correctly. However, when clicking on a URL encoded link, as mentioned in the question, these filters are saved as the "default" filters, even when navigating back to the grid. The only way to revert is to log out & back in again. Going to keep digging.
    – Moose
    Oct 26, 2015 at 7:34

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.