observer pattern - magento change default number rows displayed in adminhtml grid pages -
i set default number of displayed rows in admin higher 20.
following along @ http://inchoo.net/ecommerce/magento/magento-admin-grid-how-to-change-number-of-rows/, i'm trying make module task. magento version 1.4.2.0.
the error getting mage registry key "_singleton/grid/observer" exists
.
i have in app/code/local/company/custom/etc/config.xml
:
<config> <adminhtml> <events> <core_block_abstract_prepare_layout_before> <observers> <grid_observer> <class>grid/observer</class> <method>applylimittogrid</method> </grid_observer> </observers> </core_block_abstract_prepare_layout_before> </events> </adminhtml> </config>
and in app/code/local/company/custom/model/observer.php
:
class company_custom_grid_model_observer { public function applylimittogrid(varien_event_observer $observer) { $block = $observer->getevent()->getblock(); if (($block instanceof mage_adminhtml_block_widget_grid) && !($block instanceof mage_adminhtml_block_dashboard_grid)) { $block->setdefaultlimit(200); } } }
app/etc/modules/company_custom.xml
:
<config> <modules> <company_custom> <codepool>local</codepool> <active>true</active> </company_custom> </modules> </config>
class company_custom_grid_model_observer
should be
class company_custom_model_observer
Comments
Post a Comment