I am in a situation, where I need to display an email_address1 in grid, and during export have to use other one (email_address2). For this I have added two columns in grid, with email_address1 is visible in grid and with email_address2 will not, as shown
$this->addColumn('customer_name', array(
'header' => Mage::helper('sales')->__('Customer'),
'index' => 'email_address1',
'width' => '60',
'type' => 'text',
'filter_index' => 'email_address1'
));
$this->addColumn('customer_name_ordered', array(
'header' => Mage::helper('sales')->__('Customer'),
'index' => 'email_address2',
'column_css_class'=>'no-display',
'header_css_class'=>'no-display',
'width' => '60',
'type' => 'text',
'filter_index' => 'email_address2'
));
During export (csv or xml), both columns are being exported, how can I stop column with email_address1 from being exported, or please suggest an other solution.
My export action for CSV is like
public function exportCsvAction() {
$fileName = 'sales_order_items.csv';
$content = $this->getLayout()->createBlock('salesorderitemgrid/adminhtml_order_items_grid')->getCsv();
$this->_sendUploadResponse($fileName, $content);
}