Magento Forum

   
Massaction Grid js problem
 
Hitesh_786
Jr. Member
 
Total Posts:  4
Joined:  2012-05-03
 

hi ,
i want to add massaction in my custom block with selectall | unselectall | selectvisible | unselectvisible..

in my custom grid file which is

class Mycompany_Mymodule_Block_Adminhtml_Mymodulesent_Grid extends Mage_Adminhtml_Block_Report_Grid {

public function __construct() {
parent::__construct();
$this->setId(’mymodulesentGrid’);
$this->setDefaultSort(’created_at’);
$this->setDefaultDir(’ASC’);
$this->setSaveParametersInSession(true);
$this->setSubReportSize(false);
}

protected function _prepareCollection() {
parent::_prepareCollection();
$this->getCollection()->initReport(’mymodule/mymodulesent’);

return $this;

}

protected function _prepareMassaction()
{
$this->setMassactionIdField(’item_id’);
$this->getMassactionBlock()->setFormFieldName(’mymodule’);

$this->getMassactionBlock()->addItem(’delete’, array(
‘label’ => Mage::helper(’mymodule’)->__(’Delete’),
‘url’ => $this->getUrl(’*/*/massDelete’),
‘confirm’ => Mage::helper(’mymodule’)->__(’Are you sure?’)
));

$this->getMassactionBlock()->addItem(’test’, array(
‘label’ => Mage::helper(’mymodule’)->__(’test’),
‘url’ => $this->getUrl(’*/*/masstest’),
‘confirm’ => Mage::helper(’mymodule’)->__(’Are you sure?’)
));
$this->getMassactionBlock()->addItem(’status’, array(
‘label’=> Mage::helper(’mymodule’)->__(’Change status’),*/
return $this;
}

public function getRowUrl($row) {
return false;
}

public function getReport($from, $to) {
if ($from == ‘’) {
$from = $this->getFilter(’report_from’);
}
if ($to == ‘’) {
$to = $this->getFilter(’report_to’);
}
$totalObj = Mage::getModel(’reports/totals’);
$totals = $totalObj->countTotals($this, $from, $to);
//$this->setTotals($totals);
//$this->addGrandTotals($totals);
return $this->getCollection()->getReport($from, $to);
}

}

it perfectly gives me all the data and also gives me selectall | unselectall | selectvisible | unselectvisible .

it also gives me checkbox on which contain ‘item_id’ value..

Problem
when i press on either selectall | unselectall | selectvisible | unselectvisible , it gives me error in console
ReferenceError: mymodulesentGrid_massactionJsObject is not defined

please help me to solve this problem

 
Magento Community Magento Community
Magento Community
Magento Community
Magento Community
Magento Community
    Back to top