cancel
Showing results for 
Search instead for 
Did you mean: 

override base template file in adminhtml [Magento-Ui backend]

SOLVED

override base template file in adminhtml [Magento-Ui backend]

Hi,

I created custom grid module using ui component layout

In that i want to add new button near to filter button.

That new button should functions like action drop down function i.e capture all selected items in grid.

 

I tried to override following file in my admin module as above but its fails. 

Magento\vendor\magento\module-ui\view\base\web\templates\grid\filters\filters.html

 

 

I used requirejs config file in following path

<Namespace>\<Module>\view\adminhtml\requirejs-config.js

my override filter file in

<Namespace>\<Module>\view\adminhtml\templates\grid\filters\filters.html

 

requirejs-config.js:

 

var config = {
  "map": {
    "*": {
      "Magento_Ui/templates/grid/filters/filters.html": 
          "<Namespace>_<Module>/template/grid/filters/filters.html"
    }
  }
};

 

I am using Magento 2.1 CE version.

 

Suggesstion pls.

 

Thanks.

Tags (2)
5 REPLIES

Re: override base template file in adminhtml [Magento-Ui backend]

You can try with below way,

 

create requirejs-config.js file inside base folder instead of adminhtml folder,

var config = {
  "map": {
    "*": {
      "Magento_Ui/templates/grid/filters/filters": 
          "<Namespace>_<Module>/template/grid/filters/filters"
    }
  }
};

Remove html from templates defination

Also create template folder in your module inside base directory not use adminhtml directory,

 

New Folder Path:

<Namespace>\<Module>\view\base\web\template\grid\filters\filters.html

 

Run command,

php bin/magento setup:upgrade
php bin/magento setup:static-content:deploy

 

I have updated my answer.

 

if issue resolved, Click Kudos/Accept as solutions.

 

 

If Issue Solved, Click Kudos/Accept As solutions.

Re: override base template file in adminhtml [Magento-Ui backend]

Hi,

 

i tried as u suggest but not working 

 

My requirejs config file in following path

<Namespace>\<Module>\view\adminhtml\requirejs-config.js

is it correct?

Re: override base template file in adminhtml [Magento-Ui backend]

Sorry my requirejs config file in following path

 

<Namespace>\<Module>\view\base\requirejs-config.js

 

But its not working.

 

Re: override base template file in adminhtml [Magento-Ui backend]

Thanks Its working as you suggest.

We need one small change in our requirejs-config.js in our base folder

 

Magento_Ui/templates is mapped to ui/template in Magento\vendor\magento\module-ui\view\base\requirejs-config.js

 

So we need to remap from Magento_Ui/templates/grid/filters/filters to ui/template/grid/filters/filters

Re: override base template file in adminhtml [Magento-Ui backend]

Hi Rakesh,

 

i successfully override base filter template filters.html file as you suggest

but i have found one issue that its override all grids in product catolog, customers, sales order etc.

 

i want to override file only for my module.

 

https://community.magento.com/t5/Programming-Questions/Added-a-new-button-in-new-module-grid-but-dis...

 

Thanks.