Is it possible to set column default value to display selected type of block? enter image description here

what I mean is if the page is opened for the first time "slide" is already selected as a default?

Field definition:

        $this->addColumn('is_slide', array(
        'header'    => Mage::helper('cms')->__('Slide/Block'),
        'index'     => 'is_slide',
        'type'      => 'options',
        'options'   => array(
            0 => Mage::helper('cms')->__('Block'),
            1 => Mage::helper('cms')->__('Slide'),
            2 => Mage::helper('cms')->__('Banner')

and my _construct()


Yes. This is possible. You can do it by setting DefaultFilter. In order to do this go to your grid.php and add below mentioned code to your __construct() function.


ie: $this->setDefaultFilter(array('column_name'=>'value'));
  • Tried this but it won't work. Field name is "is_slide" and possible values 0,1,2 which are block, slide,banner :(
    – Rob D. A.
    Feb 14 '19 at 14:40
  • My _construct: parent::__construct(); $this->setId('cmsBlockGrid'); $this->setDefaultSort('block_identifier'); $this->setDefaultDir('ASC'); $this->setDefaultFilter(array('is_slide'=>1));
    – Rob D. A.
    Feb 14 '19 at 14:40
  • try is_slide=>slide
    – NID
    Feb 14 '19 at 14:42
  • Nope, does not do the job :(
    – Rob D. A.
    Feb 14 '19 at 14:45
  • are you using an option array to display this slide,block and banner?
    – NID
    Feb 14 '19 at 14:46

The answer was: $this->setDefaultFilter(array('is_slide'=> 1)); and it works. Thank you

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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