Organizational Research By

Surprising Reserch Topic

make massaction field checkbox checked on some field value in magento grid


make massaction field checkbox checked on some field value in magento grid  using -'magento,zend-framework,checkbox,grid,field'

Hi i have created a magento admin grid In this everything is working fine. But i am not getting how can i make the mass action checkbox field checked by default on the basis of some field value.
Please look at the scrrenshot  http://awesomescreenshot.com/0285byva98

My code structure is

<?php

class Iclp_Cusgrid_Block_Adminhtml_Cusgrid_Grid extends Mage_Adminhtml_Block_Widget_Grid
{

        public function __construct()
        {
                parent::__construct();
                $this->setId("cusgridGrid");
                $this->setDefaultSort("cusgrid_id");
                $this->setDefaultDir("DESC");
                $this->setSaveParametersInSession(true);
        }

        protected function _prepareCollection()
        {
                $collection = Mage::getModel("cusgrid/cusgrid")->getCollection();
                $this->setCollection($collection);
                return parent::_prepareCollection();
        }
        protected function _prepareColumns()
        {
                $this->addColumn("cusgrid_id", array(
                "header" => Mage::helper("cusgrid")->__("ID"),
                "align" =>"right",
                "width" => "50px",
                "type" => "number",
                "index" => "cusgrid_id",
                ));

                $this->addColumn("region", array(
                "header" => Mage::helper("cusgrid")->__("region"),
                "index" => "region",
                ));
                $this->addColumn("regioncode", array(
                "header" => Mage::helper("cusgrid")->__("regioncode"),
                "index" => "regioncode",
                ));
                $this->addColumn("status", array(
                "header" => Mage::helper("cusgrid")->__("regioncode"),
                "index" => "regioncode",
                ));
                $this->addColumn("status", array(
                "header" => Mage::helper("cusgrid")->__("status"),
                "index" => "status",
                ));
            $this->addExportType('*/*/exportCsv', Mage::helper('sales')->__('CSV'));
            $this->addExportType('*/*/exportExcel', Mage::helper('sales')->__('Excel'));

                return parent::_prepareColumns();
        }

        public function getRowUrl($row)
        {
               return $this->getUrl("*/*/edit", array("id" => $row->getId()));
        }



        protected function _prepareMassaction()
        {
            $this->setMassactionIdField('cusgrid_id');
            $this->getMassactionBlock()->setFormFieldName('cusgrid_ids');
            $this->getMassactionBlock()->setUseSelectAll(true);
            $this->getMassactionBlock()->addItem('Delete', array(
                     'label'=> Mage::helper('cusgrid')->__('Remove Cusgrid'),
                     'url'  => $this->getUrl('*/adminhtml_cusgrid/massRemove'),
                     'confirm' => Mage::helper('cusgrid')->__('Are you sure?')
                ));
            $this->getMassactionBlock()->addItem('Exclude', array(
                     'label'=> Mage::helper('cusgrid')->__('Exclude'),
                     'url'  => $this->getUrl('*/adminhtml_cusgrid/exclude'),
                     'confirm' => Mage::helper('cusgrid')->__('Are you sure?')
                ));
            return $this;
        }


}


can you please suggest me how can i do this.

thanks
    
asked Oct 19, 2015 by gauravsinghal83
0 votes
32 views



Related Hot Questions



Government Jobs Opening


...