我正在尝试从table
获取值,但不知道在magento
的addColumn()
函数中在哪里指定table
名称。请帮忙。以下是代码:
protected function _prepareColumns()
{
$this->addColumn('orders_count', array(
'header' => Mage::helper('sales')->__('Orders'),
'index' => 'orders_count',
'type' => 'number',
'total' => 'sum',
'sortable' => false
));
}
It looks like your Grid code
Whenever Grid is loading firstly it will load a function "_prepareCollection()" where we collect collection data to show in grid. There we define our resource model(or table).
Example:
protected function _prepareCollection() {
$collection = Mage::getResourceModel('module/table_collection');
$this->setCollection($collection);
return parent::_prepareCollection();
}