in my开发者_JS百科 own Magento Extension I'm using a grid block, to display the collection of data in my db table. Everything works fine so far and the standard pagination from magento works, too.
I now want to add some random data, which isn't in the db table, to the collection to show it in my grid. If I try as follow the pagination stops working:
class My_own_Block_Admin_Main_Grid extends Mage_Adminhtml_Block_Widget_Grid
{
protected function _prepareCollection {
// Load the collection
$collection = getResourceModel('sales/order_grid_collection');
// Add custom data
$collection->addToAll('example', 'This is a test');
// Set the collection
$this->setCollection($collection);
return parent::_prepareCollection();
}
}
The pagination is effectless now. Page 1 is the same as 2 and shows all entries.
What's the right and working way to a data to the collection without breaking the pagination?
The answer to that is prolem is the following thread
http://www.magentocommerce.com/boards/viewthread/192232/#t239222
精彩评论