如何在 magento 的 addColumn() 函数中指定 table 名称

how to specify table name in addColumn() function in magento

我正在尝试从 table 获取值,但不知道在 magentoaddColumn() 函数中的何处指定 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();
    }