0

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

6
  • check slideshow_id field is exits in model and second also check compilter is enable or not
    – Amit Bera
    May 17, 2016 at 4:03
  • Also try to change ASC to asc
    – Amit Bera
    May 17, 2016 at 4:05
  • yes, slideshow_id exist in model, & i also replace ASC with asc but sorting is not working...what is compliter..?? u mean to say compilation tool under system menu... May 17, 2016 at 4:57
  • are you using multistore ? May 17, 2016 at 6:57
  • yes i am using multi store May 17, 2016 at 7:12

2 Answers 2

1

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);
}
1

Hmm I think You have to use this code and default sorting will work for magento $this->setUseAjax(false);

1

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.