cancel
Showing results for 
Search instead for 
Did you mean: 

Magento 2 hide button Search from Grid(Created using block)

SOLVED

Magento 2 hide button Search from Grid(Created using block)

Hello,

I want to hide Search button from admin grid which is created using blocks and not ui component,

How should do I that?

 

Thank you.

 

1 ACCEPTED SOLUTION

Accepted Solutions

Re: Magento 2 hide button Search from Grid(Created using block)

The search button is added in a core file

at  vendor/magento/module-backend/Block/Widget/Grid.php 

with function 

 public function getSearchButtonHtml()
    {
        return $this->getChildHtml('search_button');
    }

 

So in my module's grid file I have added same function as follows to remove Search button

 

public function getSearchButtonHtml()
{
return '';
}

Thanks 

 

View solution in original post

1 REPLY 1

Re: Magento 2 hide button Search from Grid(Created using block)

The search button is added in a core file

at  vendor/magento/module-backend/Block/Widget/Grid.php 

with function 

 public function getSearchButtonHtml()
    {
        return $this->getChildHtml('search_button');
    }

 

So in my module's grid file I have added same function as follows to remove Search button

 

public function getSearchButtonHtml()
{
return '';
}

Thanks