class My_Module_Block_Adminhtml_My_Grid extends Mage_Adminhtml_Block_Widget_Grid_Container { public function __construct() { // Set block group and controller name for the grid $this->_blockGroup = 'my_module'; $this->_controller = 'adminhtml_my'; // Set text for the grid container $this->_headerText = 'My Grid'; parent::__construct(); } }
class My_Module_Block_Adminhtml_My_Grid extends Mage_Adminhtml_Block_Widget_Grid_Container { public function __construct() { // Set block group and controller name for the grid $this->_blockGroup = 'my_module'; $this->_controller = 'adminhtml_my'; // Set text for the grid container $this->_headerText = 'My Grid'; // Add a custom button to the container $this->_addButton('custom_button', array( 'label' => 'Custom Button', 'onclick' => 'alert("Button clicked!");', 'class' => 'custom_class' )); parent::__construct(); } }In this example, a custom button is added to the grid container using the `_addButton` method. The label, onclick function, and CSS class for the button are all set in the method call. This code could be used to add custom functionality to a grid in a Magento module. Package/library: This class is part of the Magento_Framework package/library.