I have a custom module with a backend page. In the grid, I show the customer email as the user name. By default, Magento adds a filter to every column in the grid. Now, when I try to filter by the customer's email, I get an exception saying that my custom table doesn't have an email column. Magento is trying to find that in my custom table. How can I fix this problem, or how can I remove the field of that column so that the admin can filter by that field. Thanks.
A:
I guess you meant "how can I remove the field of that column so that the admin can ' t filter by that field"
If so, I can tell you how to remove the email field.
Open /app/code/local/Namespace/Module/Block/Adminthml/Module/Grid.php
Somewhere in the protected function _prepareColumns() you should find something like :
$this->addColumn('email', array(
'header' => Mage::helper('module')->__('Email'),
'align' =>'left',
'index' => 'email',
));
Just comment this lines.
And watch out that, in the __construct method at the very beginning of the whole class, you don't have
$this->setDefaultSort('email');
If so, change it to
$this->setDefaultSort('id'); // if you have an id field in your module.
vrnet
2010-09-07 17:06:11
ok, i want to show the column, but remove the field in the top of the column, how can i do that?
Kstro21
2010-09-07 17:22:04
if i do that, i remove the column, i don't want to remove the column, just the field in the top of it, that is used to filter
Kstro21
2010-09-07 17:36:48
+1
A:
$this->addColumn('email', array( 'header' => Mage::helper('module')->__('Email'), 'align' =>'left', 'index' => 'email', 'filter' => false, ));
Charly
2010-10-27 14:55:04