Instead of having to write our own grid blocks from scratch, we can reuse the ones that are already provided by the Magento Adminhtml
module.
The block that we will be extending is called the grid widget. The grid widget is a special type of block designed to render a collection of Magento objects in a particular table grid.
A grid widget is normally rendered inside a grid container. The combination of both elements not only allows us to display our data in grid form, but also adds search, filtering, sorting, and mass action capabilities. Perform the following steps:
Navigate to the block's
Adminhtml/
folder and create a folder namedGiftregistry/
.Copy the following code inside
List.php
, located atapp/code/local/Mdg/Giftregistry/Block/Adminhtml/Customer/Edit/Tab/Giftregistry/List.php
:<?php class Mdg_Giftregistry_Block_Adminhtml_Customer_Edit_Tab_Giftregistry_List extends Mage_Adminhtml_Block_Widget_Grid { public function...