1

I want to edit gridview product values using massaction. here i created a column like this.

$this->addColumn('fineness',
            array(
                'header'=> Mage::helper('catalog')->__('% Increase'),
                'width' => '80px',
                'index' => 'fineness',
                'type' => 'input',
                'editable' => 'TRUE',


        ));

it is working fine but how can i post these value to massaction? here i wrote action like this

$this->getMassactionBlock()->addItem('update', array(
             'label'=> Mage::helper('catalog')->__('Bulk Update'),
             'url'  => $this->getUrl('*/*/massUpdate'),
             'confirm' => Mage::helper('catalog')->__('Are you sure?'),

        ));

so how can i get column values in massaction.in the action i wrote like this but not working

public function massUpdateAction()
    {
        $productIds = $this->getRequest()->getParam('product');
        $increase_fineness = $this->getRequest()->getParam('increase_fineness');
        $fineness = $this->getRequest()->getParam('fineness');
        print_r($fineness);die;
}
4

1 回答 1

0

我认为您可以采用更简单的解决方案:
只需为群众活动表单创建自己的模板,并在那里更改 onclick 事件(或为提交事件添加您自己的侦听器)。
这里的想法是使用您自己的 JS 代码(您可以将其包含在新的 .phtml 中)在提交之前使用您的自定义信息将一些输入添加到批量处理表单中。

// 这将在您的网格内(您现在可能拥有此方法,因为您应该在此处添加质量项:

protected function _prepareMassaction()
{

        // you can use widget/grid/massaction.phtml as a reference
        $this->getMassactionBlock()->setTemplate('your_custom_template_here.phtml');
                ...

作为旁注,这(基本上)是批量处理表单的工作方式:
当您选择输入复选框时,它将在批量处理表单上创建一个输入元素,该输入将具有您所选行的 ID,以逗号分隔。
然后 Magento 有一个观察者(监听“adminhtml_controller_action_predispatch_start”)

Mage_Adminhtml_Model_Observer::massactionPrepareKey

这会将逗号分隔的值转换为数组,这就是您在 massaction Action 中接收所选项目数组的方式。

于 2013-02-28T14:05:38.913 回答