我想将管理中显示的行的默认数量设置为高于20.
我沿着http://inchoo.net/ecommerce/magento/magento-admin-grid-how-to-change-number-of-rows/,但我试图制作一个模块做任务。 Magento版本是1.4.2.0。magento更改在adminhtml网格页面中显示的默认数行
我得到的错误是Mage registry key "_singleton/grid/observer" already exists
。
我在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>
和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>
这使我在正确的道路上;班级名称在两个地方实际上是错误的... – elcash 2011-06-07 05:12:30