Magento 1.9 – Set Default Filter Value for Column Grid

adminbackendgridmagento-1.9sales-order

I want to have a default value in a column on sales grid, the value will be the actual day.

$this->addColumn('created_at', array(
        'header' => Mage::helper('sales')->__('Purchased On'),
        'index' => 'created_at',
        'type' => 'datetime',
        'width' => '100px',
        'filter_index' => 'main_table.created_at',

        'value'=>array(
            'from'=>date('Y-m-d', time())
        )
    ));

But its not working and I don't know why.

How can I do that?

Best Answer

try below code

$this->addColumn('created_at', array(
    'header' => Mage::helper('sales')->__('Purchased On'),
    'index' => 'created_at',
    'type' => 'datetime',
    'width' => '100px',
    'filter_index' => 'main_table.created_at',

    'value'=>array(
        'from'=>date('Y-m-d')
    )
));
Related Topic