后台gird表单按钮操作

1.$this->_removeButton('reset');#########################################删除重置这个按钮。
2.$this->_addButton("new",array(######################按钮的添加
     'label'     => Mage::helper('new')->__('继续添加'),############ 按钮的名称
     'onclick'   => "confirmSetLocation('AAA', '{$this->getUrl('*/*/cancel')}')",//这里是在跳转之前跳出一个对话框
     'onclick'   => "setLocation('{$this->getUrl('*/*/new')}')",//直接跳转到你想到的功能动作(这里的new是方法Action)
     'class'   => 'save'
            ));
案例:
   if(!!$batch && !!$batch->getId()){
          // 有管理员权限可以删除
          if(!Mage::getSingleton('admin/session')->isAllowed('warehouse/manage_admin')){
           $this->_removeButton('delete');
          }
         
       $this->_addButton('entry', array(
           'label'    => Mage::helper('warehouse')->__('入库'),
           'onclick'  => "setLocation('{$this->getUrl('*/*/recordEntry', array('id' =>$batch->getId()))}')",
           'class'    => 'save'
       ));
       $this->_addButton('delivery', array(
           'label'    => Mage::helper('warehouse')->__('发货'),
           'onclick'  => "setLocation('{$this->getUrl('*/*/recordDelivery', array('id' =>$batch->getId()))}')",
           'class'    => 'save'
       ));
       $this->_addButton('reissue', array(
           'label'    => Mage::helper('warehouse')->__('补货'),
           'onclick'  => "setLocation('{$this->getUrl('*/*/recordReissue', array('id' =>$batch->getId()))}')",
           'class'    => 'save'
       ));
       $this->_addButton('return', array(
           'label'    => Mage::helper('warehouse')->__('退货'),
           'onclick'  => "setLocation('{$this->getUrl('*/*/recordReturn', array('id' => $batch->getId()))}')",
           'class'    => 'save'
       ));
       $this->_addButton('adjustment', array(
           'label'    => Mage::helper('warehouse')->__('调整'),
           'onclick'  => "setLocation('{$this->getUrl('*/*/recordAdjustment', array('id' =>$batch->getId()))}')",
           'class'    => 'save'
       ));
       $this->_addButton('record_grid', array(
           'label'    => Mage::helper('warehouse')->__('操作列表'),
           'onclick'  => "setLocation('{$this->getUrl('warehouse_adminhtml/record/index',//另一个控制器                      

    array('batch_id' => $batch->getId()))}')",
           'class'    => 'save'
       ));
        }

原文地址:https://www.cnblogs.com/sqsnbrdcwlcfzj/p/6221044.html