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?

Marius
199k55 gold badges431 silver badges837 bronze badges
asked Jan 29, 2014 at 11:31
4
  • The table schema is cached even when cache is disabled. Maybe that's it. You need to clear the cache. 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. 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. 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. 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.

answered Feb 21, 2014 at 7:22

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.