Here is my code:
class Dolphin_Slideshow_Block_Adminhtml_Slideshow_Grid extends Mage_Adminhtml_Block_Widget_Grid
{
public function __construct()
{
parent::__construct();
$this->setId('slideshowGrid');
$this->setDefaultSort('slideshow_id');
$this->setDefaultDir('ASC');
$this->setSaveParametersInSession(true);
$this->setUseAjax(true);
}
}
getGridUrl() function in grid.php:
public function getGridUrl()
{
return $this->getUrl('*/*/grid', array('_current'=>true));
}
gridAction() function in controller:
public function gridAction()
{
$this->loadLayout();
$this->getResponse()->setBody(
$this->getLayout()->createBlock('slideshow/adminhtml_slideshow_grid')->toHtml()
);
}
Updates: Now, after so many try...i found if i removed foreach loop from preparecollection method then My Sorting is working....but after doing this....All store views title are not fetch into admin grid .. but there is no problem with english, french
2 Answers 2
try this one may be it will help you for the filter and may resolve your sorting ...
protected function _filterStoreCondition($collection, $column)
{
if (!$value = $column->getFilter()->getValue()) {
return;
}
$this->getCollection()->addStoreFilter($value);
}
Hmm I think You have to use this code and default sorting will work for magento $this->setUseAjax(false);
-
its not workingMagento 2 Learner– Magento 2 Learner2016年05月18日 09:23:20 +00:00Commented May 18, 2016 at 9:23
slideshow_idfield is exits in model and second also check compilter is enable or notASCtoasc