2

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.

For adding new button i followed link

Magento 2 override module-ui from custom theme

I think the above link for front end theme development. But i want back end module

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

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

1
  • Did you resolve this problem?
    – 3CE
    Nov 8, 2017 at 16:59

1 Answer 1

1

Create the following module to override filters.html :

1 Module Name: SG_AdminJS

2 Create registration.php inside SG/AdminJS/ with following code:

<?php
\Magento\Framework\Component\ComponentRegistrar::register(
    \Magento\Framework\Component\ComponentRegistrar::MODULE,
    'SG_AdminJS',
    __DIR__
);
?>

3 Create module.xml inside SG/AdminJS/etc/ directory with following code:

<?xml version="1.0"?>
<config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:framework:Module/etc/module.xsd">
    <module name="SG_AdminJS" setup_version="1.0.0">
        <sequence>
            <module name="Magento_Ui" />
            <module name="Magento_Backend" />
        </sequence>
    </module>
</config>

4 Create requirejs-config.js inside SG/AdminJS/view/base/ with following code:

/**
 * Copyright © Magento, Inc. All rights reserved.
 * See COPYING.txt for license details.
 */

var config = {
    map: {
        '*': {
          'ui/template/grid/filters/filters': 
              'SG_AdminJS/template/grid/filters/filters'
        }
  }
};
  1. Now copy filters.html from vendor/magento/module-ui/view/base/web/templates/grid/filters/filters.html and paste this file into following directory inside your module:

    SG/AdminJS/view/base/web/template/grid/filters

Now activate the module and flush the cache by executing the following commands:

php bin/magento setup:upgrade

php bin/magento setup:static-content:deploy

php bin/magento cache:flush

Note: I have tested this module in 2.3.0 and it's working fine.

Hope it will help someone.

This site is temporarily in read-only mode and not accepting new answers.

Not the answer you're looking for? Browse other questions tagged .