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

asked May 17, 2016 at 3:52
6
  • check slideshow_id field is exits in model and second also check compilter is enable or not Commented May 17, 2016 at 4:03
  • Also try to change ASC to asc Commented 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... Commented May 17, 2016 at 4:57
  • are you using multistore ? Commented May 17, 2016 at 6:57
  • yes i am using multi store Commented 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);
}
Anil Suthar
4,7311 gold badge16 silver badges22 bronze badges
answered May 17, 2016 at 12:51
1

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

answered May 18, 2016 at 7:17
1
  • its not working Commented May 18, 2016 at 9:23

Your Answer

Draft saved
Draft discarded

Sign up or log in

Sign up using Google
Sign up using Email and Password

Post as a guest

Required, but never shown

Post as a guest

Required, but never shown

By clicking "Post Your Answer", you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.