In My Custom Module, In Admin Grid Reset Filter And Search Button Not Working.
Here Is My Grid.php Code.
C:\xampp2\htdocs\testmagento\app\code\local\Sigmasolve\Makemodel\Block\Adminhtml\Makemodel\Grid.php
<?php
class Sigmasolve_Makemodel_Block_Adminhtml_Makemodel_Grid extends Mage_Adminhtml_Block_Widget_Grid
{
public function __construct()
{
parent::__construct();
$this->setId('makemodelGrid');
// This is the primary key of the database
$this->setDefaultSort('id');
$this->setDefaultDir('ASC');
$this->setSaveParametersInSession(true);
$this->setUseAjax(true);
}
protected function _prepareMassaction()
{
$this->setMassactionIdField('id');
$this->getMassactionBlock()->setFormFieldName('makemodel');
$this->getMassactionBlock()->addItem('delete', array(
'label' => Mage::helper('makemodel')->__('Delete'),
'url' => $this->getUrl('*/*/massDelete', array('' => '')),
'confirm' => Mage::helper('makemodel')->__('Are you sure?')
));
//$statuses = Mage::getSingleton('makemodel/status')->getOptionArray();
// array_unshift($statuses, array('label'=>'', 'value'=>''));
// $this->getMassactionBlock()->addItem('status', array(
// 'label'=> Mage::helper('makemodel')->__('Change status'),
// 'url' => $this->getUrl('*/*/massStatus', array('_current'=>true)),
// 'additional' => array(
// 'visibility' => array(
// 'name' => 'status',
// 'type' => 'select',
// 'class' => 'required-entry',
// 'label' => Mage::helper('makemodel')->__('Status'),
// 'values' => $statuse
//)
//)
// ));
return $this;
}
protected function _prepareCollection()
{
$collection = Mage::getModel('makemodel/makemodel')->getCollection();
$this->setCollection($collection);
return parent::_prepareCollection();
}
protected function _prepareColumns()
{
$this->addColumn('id', array(
'header' => Mage::helper('makemodel')->__('ID'),
'align' =>'right',
'width' => '50px',
'index' => 'id',
));
$this->addColumn('ktyp', array(
'header' => Mage::helper('makemodel')->__('Ktyp'),
'align' =>'left',
'index' => 'ktyp',
));
$this->addColumn('manufacturer', array(
'header' => Mage::helper('makemodel')->__('Manufacturer'),
'align' =>'left',
'index' => 'manufacturer',
));
$this->addColumn('model', array(
'header' => Mage::helper('makemodel')->__('Model'),
'align' =>'left',
'index' => 'model',
));
$this->addColumn('capacity', array(
'header' => Mage::helper('makemodel')->__('Capacity'),
'align' =>'left',
'index' => 'capacity',
));
$this->addColumn('year_from', array(
'header' => Mage::helper('makemodel')->__('Year_From'),
'align' =>'left',
'index' => 'year_from',
));
$this->addColumn('year_to', array(
'header' => Mage::helper('makemodel')->__('Year_To'),
'align' =>'left',
'index' => 'year_to',
));
$this->addColumn('fuel', array(
'header' => Mage::helper('makemodel')->__('Fuel'),
'align' =>'left',
'index' => 'fuel',
));
return parent::_prepareColumns();
}
public function getRowUrl($row)
{
return $this->getUrl('*/*/edit', array('id' => $row->getId()));
}
public function getGridUrl()
{
return $this->getUrl('*/*/grid', array('_current'=>true));
}
}
When I Click Reset Filter Or Search Button It Is Go To Front End
Best Answer
I Found My Mistake. I Forgot Write Code in My Controller File.
So, that's why Code is not working. Thanks for Help...