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


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();
    }