I have created a custom grid and collection. Now, I am saving the filters to session for future use using:


and retrieving this in another controller. How am I going to apply these parameters upon loading the collection?

I can retrieve the parameters/filters using:

$filters = Mage::getSingleton('adminhtml/session')->getData('custom_block_gridfilter');
$filters = Mage::helper('adminhtml')->prepareFilterString($filters);

Now, how am I going to apply it to?


Or perhaps how am I going to retrieve the grid collection with the filters applied to it?


Theoretically \Mage_Adminhtml_Block_Widget_Grid::_prepareCollection should take care of this.

So if you have overwritten this method, maybe the problem is only, that you don't call parent::_prepareCollection

  • So this isn't possible to be retrieved using some custom model that doesn't inherit Mage_Adminhtml_Block_Widget_Grid? – user1240207 Nov 18 '15 at 23:04
  • Why would one do that?! :D And to answer the question: Sure it is doable. At least by copying all the code... – Fabian Blechschmidt Nov 18 '15 at 23:07
  • 1
    Assuming you have millions of items in a collection, then in a custom grid which has been filtered already into a smaller set, then you have another page let's say mass edit for the items that have been filtered/selected, then you might wanna retrieve those items to some other custom controller/model. – user1240207 Nov 19 '15 at 2:19

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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