I created a grid in the Magento admin, but the functionality like sort, filter and search doesn't work and that is because I didn't use a database table to get the information. I use a web service that connects with redmine and I get all the information. I reviewed and I founded that the default sort, search and filter of the Magento grid only works with models or collections, but I can't find a way to do the same but with my own collection (in this case the info that I get from the web service)

2 Answers 2


Thought I'd post this as I feel it contributes, but it does not fully answer your question.

I've recently hacked together something that supports an admin panel grid from a non-database source, however it was not built with web-service calls in mind.

It might be useful for people in the future if they want to embark on this kind of functionality to see what I've done.



To be honest, it's a mess. As you point out, the Adminhtml grid widget assumes that it is working with a Varien_Data_Collection_Db instance, yet this is not enforced in the code:

 * set collection object
 * @param Varien_Data_Collection $collection
//public function setCollection(Varien_Data_Collection $collection)
public function setCollection($collection)
    $this->_collection = $collection;

This setter implies that the grid widget is built in a generic way, but there are several assumptions that the $_collection object implements several methods from the collection class hierarchy:

  • ::_addColumnFilterToCollection() calls addFieldToFilter()
  • ::_prepareCollection() calls load()
  • ::_preparePage() calls setPageSize() and setCurPage()
  • ::_exportIterateCollection() calls getSize() and getLastPageNumber()
  • ...et cetera...

You will need to map your resource set to a Varien_Data_Collection_Db instance and each entity to a Varien_Object to get this working. The more grid goodies you want to use (e.g. export to CSV), the more work you may need to do.

  • Which is why most 3rd parties that need to do exactly this rely on a windowed / iframe approach with an API key.
    – philwinkle
    Dec 18, 2014 at 23:36
  • Then benmarks you suggest that I need create a table with the web service info and with that create a model and collection for use the grid options like sorting, filter, export to csv, etc? Dec 18, 2014 at 23:36
  • @RicardoCortes - It's an option, and maybe a good one if say a 15min delay is okay. You could also wrap the API calls in the various methods of the expected classes. Your call!
    – benmarks
    Dec 19, 2014 at 18:47

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.