I am trying to get values from a table
but don't know where to specify table
name in addColumn()
function in magento
. Kindly help.
Following is the code:
protected function _prepareColumns()
{
$this->addColumn('orders_count', array(
'header' => Mage::helper('sales')->__('Orders'),
'index' => 'orders_count',
'type' => 'number',
'total' => 'sum',
'sortable' => false
));
}
答案 0 :(得分:0)
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();
}