1

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.

Screencast

any help would be very appreciate.

asked Feb 14, 2017 at 5:12
3
  • in which magento version? Commented Feb 14, 2017 at 5:17
  • magento version 1.8 Commented Feb 14, 2017 at 5:20
  • you can try the answer given in grid.php Commented Feb 14, 2017 at 5:24

4 Answers 4

2

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);
 }
 });
 ");
}
answered Feb 14, 2017 at 6:04
1
  • Solved for me, thanks! Commented Dec 28, 2023 at 3:25
0

Please use the following code in grid.php for magento 1.x.x:

public function getRowUrl($row)
{
 return false;
}
answered Feb 14, 2017 at 5:23
4
  • This will remove url or not remove click event Commented Feb 14, 2017 at 5:27
  • 1
    click event is coming because of the row url , so if you want to remove click event, you have to remove row url. Commented Feb 14, 2017 at 5:31
  • I did but nothing was changed :( Commented Feb 14, 2017 at 5:40
  • clear cache and try. Commented Feb 14, 2017 at 5:45
0

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

answered Feb 14, 2017 at 5:51
1
  • This "works" but breaks any other javascript on the row such as serializer etc. Commented Sep 23, 2024 at 15:39
0

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>
answered Dec 4, 2018 at 6:30

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.