我在sales_order_grid表中添加了一个自定义列,并在grid.php的_prepareColumns()函数中添加了此代码,此复选框现在显示但我无法在此列添加onclick函数,
$this->addColumn('exported', array(
'header' => Mage::helper('sales')->__('Exported'),
'index' => 'exported',
'type' => 'checkbox',
'field_name'=>'exported_',
'values' => array(1,2),//$this->_getExported(),//
'onclick' => $this->getJsObjectName('addRelatedToExport'),
));
我被困4天了,救救我, 提前谢谢。
答案 0 :(得分:0)
在网格文件中包含此功能。 Grid.php
protected function _prepareMassaction(){
$this->setMassactionIdField('entity_id'); // code to make the checkbox related with
$this->getMassactionBlock()->setFormFieldName('form_field_name');
$this->getMassactionBlock()->addItem('addRelatedToExport', array(
'label'=> Mage::helper('ModuleName')->__('Add to Export'),
'url' => $this->getUrl('*/*/massRelatedExport')
));
return $this;
}
然后在同一模块控制器中,例如ModuleName/controllers/adminhtml/someController
public function massRelatedExportAction(){
// your code here
}