With openGridRow
you were already close to the solution. This is the default JS callback, but you can change it with the row_click_callback
property of the grid widget. For no action at all, use:
$this->setRowClickCallback(null);
The default value is set in Mage_Adminhtml_Block_Widget_Grid::__construct()
, so you can override the constructor and add this line after parent::__construct()
The final solution ended up being modifying Tab.php to look like:
<?php
class Company_WordpressIntegration_Block_Adminhtml_Catalog_Product_Tab
extends Mage_Adminhtml_Block_Widget_Grid
implements Mage_Adminhtml_Block_Widget_Tab_Interface
{
public function __construct()
{
parent::__construct();
$this->setId('company_wordpressintegration_grid');
$this->setDefaultSort('ID');
$this->setDefaultDir('DESC');
$this->setSaveParametersInSession(true);
$this->setUseAjax(true);
}
protected function _prepareCollection()
{
$collection = Mage::getModel('wordpressintegration/post')->getCollection();
$this->setCollection($collection);
parent::_prepareCollection();
return $this;
}
protected function _prepareColumns()
{
$helper = Mage::helper('company_wordpressintegration');
$currency = (string) Mage::getStoreConfig(Mage_Directory_Model_Currency::XML_PATH_CURRENCY_BASE);
$this->addColumn('itemCheckbox', array(
'index' => 'ID',
'type' => 'checkbox',
'width' => 20,
'sortable' => false,
'field_name' => 'map[]'
));
$this->addColumn('ID', array(
'header' => $helper->__('ID'),
'index' => 'ID'
));
$this->addColumn('post_author', array(
'header' => $helper->__('Author'),
'index' => 'post_author'
));
$this->addColumn('post_date', array(
'header' => $helper->__('Date'),
'type' => 'datetime',
'index' => 'post_date'
));
$this->addColumn('post_title', array(
'header' => $helper->__('Title'),
'index' => 'post_title'
));
$this->addColumn('post_content', array(
'header' => $helper->__('Content'),
'index' => 'post_content'
));
$this->addColumn('post_status', array(
'header' => $helper->__('Status'),
'index' => 'post_status'
));
$this->addExportType('*/*/exportRelatedCsv', $helper->__('CSV'));
$this->addExportType('*/*/exportRelatedExcel', $helper->__('Excel XML'));
return parent::_prepareColumns();
}
public function getGridUrl()
{
return $this->getUrl('*/*/grid', array('_current'=>true));
}
/**
* Retrieve the label used for the tab relating to this block
*
* @return string
*/
public function getTabLabel()
{
return $this->__('Related Projects');
}
/**
* Retrieve the title used by this tab
*
* @return string
*/
public function getTabTitle()
{
return $this->__('Click here to view your custom tab content');
}
/**
* Determines whether to display the tab
* Add logic here to decide whether you want the tab to display
*
* @return bool
*/
public function canShowTab()
{
return true;
}
/**
* Stops the tab being hidden
*
* @return bool
*/
public function isHidden()
{
return false;
}
}
This negates the need for the additional grid and grid containers. Notice aside from the grid functions being moved into the tab file, the file now extends the grid, but continues to implement the tab interface.
Best Answer
To remove row url on grid, you need to edit function getRowUrl in file Grid.php as below: