0

When creating a custom adminhtml grid, I've run into a very strange issue when modifying the column type in the database from for instance Date to varchar:

Initially - works 100% (as type Date in the table):

$this->addColumn('credit_date',
        array(
            'header'=> $this->__('Credit<br/>Date'),
            'index' => 'credit_date',
            'width' => '5%',
            'type' => 'date'
        )
    );

Updated to varchar in the table:

$this->addColumn('credit_date',
        array(
            'header'=> $this->__('Credit<br/>Date'),
            'index' => 'credit_date',
            'width' => '5%'
        )
    );

After a full re-index & cache refresh, refreshing the page now only displays the column titles and no records. I found that if I rename the column name in the table & magento, it then displays 100%.

What is the reasoning behind this strange behvaior?

4
  • The table schema is cached even when cache is disabled. Maybe that's it. You need to clear the cache.
    – Marius
    Commented Jan 29, 2014 at 11:33
  • @Marius - I did refresh all caches, flushed Magento cache & cache storage as well as JS/CSS cache on top of reindexing all of the tables. The issue persists through this.
    – Moose
    Commented Jan 29, 2014 at 11:34
  • 1
    After changing the column type, did you log out? The problem might appear if you have the grid parameters stored in session.
    – Marius
    Commented Feb 21, 2014 at 6:53
  • That was indeed the issue @Marius, session persist. Thanks, you can post an answer and I'll accept it.
    – Moose
    Commented Feb 21, 2014 at 7:19

1 Answer 1

2

Based on the discussion in the comments, the error appears because the grid uses saveParametersInSession set to true. The values stored in the session conflict with the database values and column names.
Solution: Log out and re login in the admin panel.

Your Answer

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

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