I have form grid with selectbox in grid. so i would like to make row unclickable because when i try to click on select box it trigger checkbox too.
any help would be very appreciate.
Magento Stack Exchange is a question and answer site for users of the Magento e-Commerce platform. It only takes a minute to sign up.
Sign up to join this communityI have form grid with selectbox in grid. so i would like to make row unclickable because when i try to click on select box it trigger checkbox too.
any help would be very appreciate.
This is how i achieve this.
This is my grid constructor and code is as below.it will stop fire onrowclick event on selectbox click.
public function __construct()
{
parent::__construct();
$this->setId('customerGrid');
$this->setUseAjax(true); // Using ajax grid is important
$this->setDefaultSort('id');
$this->setDefaultFilter(array('customer_ids'=>1)); // By default we have added a filter for the rows, that in_products value to be 1
$this->setSaveParametersInSession(false); //Dont save paramters in session or else it creates problems
$this->setAdditionalJavaScript("
// added click on selectbox support
serializerController.prototype.rowClick = serializerController.prototype.rowClick.wrap(function(o, grid, event) {
var tagName = Event.element(event).tagName
isSelect = (tagName == 'SELECT' || tagName == 'OPTION');
if (!isSelect) {
o(grid, event);
}
});
");
}
Please use the following code in grid.php for magento 1.x.x:
public function getRowUrl($row)
{
return false;
}
By adding the following method
getRowClickCallback
to my grid class (that overrides a core grid Mage_Adminhtml_Block_Catalog_Product_Grid), that returns some fake JS function, like this
public function getRowClickCallback()
{
return 'fakeJsFunction';
}
And this can help you in achieving your requirement
If you will not pass "rowUrl" function in argument, In grid section Row URL will not be set.
<block class="Magento\Backend\Block\Widget\Grid\ColumnSet" as="grid.columnSet" name="adminhtml.promo.quote.grid.columnSet">
<!--<arguments>
<argument name="rowUrl" xsi:type="array">
<item name="path" xsi:type="string">ezerus_shippingreport/*/*</item>
<item name="extraParamsTemplate" xsi:type="array">
<item name="id" xsi:type="string">getId</item>
</item>
</argument>
</arguments>-->
<block class="Magento\Backend\Block\Widget\Grid\Column" as="entity_id">
<arguments>
<argument name="header" xsi:type="string" translate="true">ID</argument>
<argument name="index" xsi:type="string">entity_id</argument>
<argument name="column_css_class" xsi:type="string">col-id</argument>
<argument name="header_css_class" xsi:type="string">col-id</argument>
</arguments>
</block>
</block>