Magento 2 - How to remove “Add New Customer” button in Index Admin Customer












1















How to remove "Add New Customer" in Index Admin Customer:
enter image description here



I created a new module:

Create 2 file:

1) NameSpace/Module/view/adminhtml/layout/customer_index_index.xml



<?xml version="1.0" encoding="UTF-8"?>
<referenceContainer name="content">
<uiComponent name="customer_listing">
</uiComponent>
</referenceContainer>


2) NameSpace/Module/view/adminhtml/ui_component/customer_listing.xml



<?xml version="1.0" encoding="UTF-8"?>
<!--
/**
* Copyright © 2015 Magento. All rights reserved.
* See COPYING.txt for license details.
*/
-->
<listing xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:module:Magento_Ui:etc/ui_configuration.xsd">
<argument name="data" xsi:type="array">
<item name="js_config" xsi:type="array">
<item name="provider" xsi:type="string">customer_listing.customer_listing_data_source</item>
<item name="deps" xsi:type="string">customer_listing.customer_listing_data_source</item>
</item>
<item name="spinner" xsi:type="string">customer_columns</item>
<item name="buttons" xsi:type="array" >
<item name="add" xsi:type="array">
<item name="name" xsi:type="string">add</item>
<item name="label" xsi:type="string" translate="true">Add New Customer</item>
<item name="class" xsi:type="string">primary</item>
<item name="url" xsi:type="string">*/*/new</item>
<item name="style" xsi:type="string">display:none</item>
</item>
</item>
</argument>
<dataSource name="customer_listing_data_source">
<argument name="dataProvider" xsi:type="configurableObject">
<argument name="class" xsi:type="string">MagentoCustomerUiComponentDataProvider</argument>
<argument name="name" xsi:type="string">customer_listing_data_source</argument>
<argument name="primaryFieldName" xsi:type="string">entity_id</argument>
<argument name="requestFieldName" xsi:type="string">id</argument>
<argument name="data" xsi:type="array">
<item name="config" xsi:type="array">
<item name="update_url" xsi:type="url" path="mui/index/render"/>
</item>
</argument>
</argument>
<argument name="data" xsi:type="array">
<item name="js_config" xsi:type="array">
<item name="component" xsi:type="string">Magento_Ui/js/grid/provider</item>
</item>
</argument>
</dataSource>
<container name="listing_top">
<argument name="data" xsi:type="array">
<item name="config" xsi:type="array">
<item name="template" xsi:type="string">ui/grid/toolbar</item>
</item>
</argument>
<bookmark name="bookmarks">
<argument name="data" xsi:type="array">
<item name="config" xsi:type="array">
<item name="storageConfig" xsi:type="array">
<item name="namespace" xsi:type="string">customer_listing</item>
</item>
</item>
</argument>
</bookmark>
<component name="columns_controls">
<argument name="data" xsi:type="array">
<item name="config" xsi:type="array">
<item name="columnsData" xsi:type="array">
<item name="provider" xsi:type="string">customer_listing.customer_listing.customer_columns</item>
</item>
<item name="component" xsi:type="string">Magento_Ui/js/grid/controls/columns</item>
<item name="displayArea" xsi:type="string">dataGridActions</item>
</item>
</argument>
</component>
<exportButton name="export_button">
<argument name="data" xsi:type="array">
<item name="config" xsi:type="array">
<item name="selectProvider" xsi:type="string">customer_listing.customer_listing.customer_columns.ids</item>
</item>
</argument>
</exportButton>
<filterSearch name="fulltext">
<argument name="data" xsi:type="array">
<item name="config" xsi:type="array">
<item name="provider" xsi:type="string">customer_listing.customer_listing_data_source</item>
<item name="chipsProvider" xsi:type="string">customer_listing.customer_listing.listing_top.listing_filters_chips</item>
<item name="storageConfig" xsi:type="array">
<item name="provider" xsi:type="string">customer_listing.customer_listing.listing_top.bookmarks</item>
<item name="namespace" xsi:type="string">current.search</item>
</item>
</item>
</argument>
</filterSearch>
<filters name="listing_filters">
<argument name="data" xsi:type="array">
<item name="config" xsi:type="array">
<item name="columnsProvider" xsi:type="string">customer_listing.customer_listing.customer_columns</item>
<item name="storageConfig" xsi:type="array">
<item name="provider" xsi:type="string">customer_listing.customer_listing.listing_top.bookmarks</item>
<item name="namespace" xsi:type="string">current.filters</item>
</item>
<item name="childDefaults" xsi:type="array">
<item name="provider" xsi:type="string">customer_listing.customer_listing.listing_top.listing_filters</item>
<item name="imports" xsi:type="array">
<item name="visible" xsi:type="string">customer_listing.customer_listing.customer_columns.${ $.index }:visible</item>
</item>
</item>
</item>
</argument>
</filters>
<massaction name="listing_massaction">
<argument name="data" xsi:type="array">
<item name="config" xsi:type="array">
<item name="selectProvider" xsi:type="string">customer_listing.customer_listing.customer_columns.ids</item>
<item name="component" xsi:type="string">Magento_Ui/js/grid/tree-massactions</item>
<item name="indexField" xsi:type="string">entity_id</item>
</item>
</argument>
<action name="delete">
<argument name="data" xsi:type="array">
<item name="config" xsi:type="array">
<item name="type" xsi:type="string">delete</item>
<item name="label" xsi:type="string" translate="true">Delete</item>
<item name="url" xsi:type="url" path="customer/index/massDelete"/>
<item name="confirm" xsi:type="array">
<item name="title" xsi:type="string" translate="true">Delete items</item>
<item name="message" xsi:type="string" translate="true">Are you sure to delete selected customers?</item>
</item>
</item>
</argument>
</action>
<action name="subscribe">
<argument name="data" xsi:type="array">
<item name="config" xsi:type="array">
<item name="type" xsi:type="string">subscribe</item>
<item name="label" xsi:type="string" translate="true">Subscribe to Newsletter</item>
<item name="url" xsi:type="url" path="customer/index/massSubscribe"/>
</item>
</argument>
</action>
<action name="unsubscribe">
<argument name="data" xsi:type="array">
<item name="config" xsi:type="array">
<item name="type" xsi:type="string">unsubscribe</item>
<item name="label" xsi:type="string" translate="true">Unsubscribe from Newsletter</item>
<item name="url" xsi:type="url" path="customer/index/massUnsubscribe"/>
<item name="confirm" xsi:type="array">
<item name="title" xsi:type="string" translate="true">Unsubscribe from Newsletter</item>
<item name="message" xsi:type="string" translate="true">Are you sure to unsubscribe selected customers from newsletter?</item>
</item>
</item>
</argument>
</action>
<action name="assign_to_group">
<argument name="data" xsi:type="array">
<item name="config" xsi:type="array">
<item name="type" xsi:type="string">assign_to_group</item>
<item name="label" xsi:type="string" translate="true">Assign a Customer Group</item>
</item>
</argument>
................................
...................................
</listing>


When I removed "Add New Customer" by remove some code in this xml file:



<argument name="data" xsi:type="array">
<item name="js_config" xsi:type="array">
<item name="provider" xsi:type="string">customer_listing.customer_listing_data_source</item>
<item name="deps" xsi:type="string">customer_listing.customer_listing_data_source</item>
</item>
<item name="spinner" xsi:type="string">customer_columns</item>
<item name="buttons" xsi:type="array" >
<item name="add" xsi:type="array">
<item name="name" xsi:type="string">add</item>
<item name="label" xsi:type="string" translate="true">Add New Customer</item>
<item name="class" xsi:type="string">primary</item>
<item name="url" xsi:type="string">*/*/new</item>
<item name="style" xsi:type="string">display:none</item>
</item>
</item>
</argument>


But it reused original core layout,Anyone know, show me pls!Thanks!










share|improve this question





























    1















    How to remove "Add New Customer" in Index Admin Customer:
    enter image description here



    I created a new module:

    Create 2 file:

    1) NameSpace/Module/view/adminhtml/layout/customer_index_index.xml



    <?xml version="1.0" encoding="UTF-8"?>
    <referenceContainer name="content">
    <uiComponent name="customer_listing">
    </uiComponent>
    </referenceContainer>


    2) NameSpace/Module/view/adminhtml/ui_component/customer_listing.xml



    <?xml version="1.0" encoding="UTF-8"?>
    <!--
    /**
    * Copyright © 2015 Magento. All rights reserved.
    * See COPYING.txt for license details.
    */
    -->
    <listing xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:module:Magento_Ui:etc/ui_configuration.xsd">
    <argument name="data" xsi:type="array">
    <item name="js_config" xsi:type="array">
    <item name="provider" xsi:type="string">customer_listing.customer_listing_data_source</item>
    <item name="deps" xsi:type="string">customer_listing.customer_listing_data_source</item>
    </item>
    <item name="spinner" xsi:type="string">customer_columns</item>
    <item name="buttons" xsi:type="array" >
    <item name="add" xsi:type="array">
    <item name="name" xsi:type="string">add</item>
    <item name="label" xsi:type="string" translate="true">Add New Customer</item>
    <item name="class" xsi:type="string">primary</item>
    <item name="url" xsi:type="string">*/*/new</item>
    <item name="style" xsi:type="string">display:none</item>
    </item>
    </item>
    </argument>
    <dataSource name="customer_listing_data_source">
    <argument name="dataProvider" xsi:type="configurableObject">
    <argument name="class" xsi:type="string">MagentoCustomerUiComponentDataProvider</argument>
    <argument name="name" xsi:type="string">customer_listing_data_source</argument>
    <argument name="primaryFieldName" xsi:type="string">entity_id</argument>
    <argument name="requestFieldName" xsi:type="string">id</argument>
    <argument name="data" xsi:type="array">
    <item name="config" xsi:type="array">
    <item name="update_url" xsi:type="url" path="mui/index/render"/>
    </item>
    </argument>
    </argument>
    <argument name="data" xsi:type="array">
    <item name="js_config" xsi:type="array">
    <item name="component" xsi:type="string">Magento_Ui/js/grid/provider</item>
    </item>
    </argument>
    </dataSource>
    <container name="listing_top">
    <argument name="data" xsi:type="array">
    <item name="config" xsi:type="array">
    <item name="template" xsi:type="string">ui/grid/toolbar</item>
    </item>
    </argument>
    <bookmark name="bookmarks">
    <argument name="data" xsi:type="array">
    <item name="config" xsi:type="array">
    <item name="storageConfig" xsi:type="array">
    <item name="namespace" xsi:type="string">customer_listing</item>
    </item>
    </item>
    </argument>
    </bookmark>
    <component name="columns_controls">
    <argument name="data" xsi:type="array">
    <item name="config" xsi:type="array">
    <item name="columnsData" xsi:type="array">
    <item name="provider" xsi:type="string">customer_listing.customer_listing.customer_columns</item>
    </item>
    <item name="component" xsi:type="string">Magento_Ui/js/grid/controls/columns</item>
    <item name="displayArea" xsi:type="string">dataGridActions</item>
    </item>
    </argument>
    </component>
    <exportButton name="export_button">
    <argument name="data" xsi:type="array">
    <item name="config" xsi:type="array">
    <item name="selectProvider" xsi:type="string">customer_listing.customer_listing.customer_columns.ids</item>
    </item>
    </argument>
    </exportButton>
    <filterSearch name="fulltext">
    <argument name="data" xsi:type="array">
    <item name="config" xsi:type="array">
    <item name="provider" xsi:type="string">customer_listing.customer_listing_data_source</item>
    <item name="chipsProvider" xsi:type="string">customer_listing.customer_listing.listing_top.listing_filters_chips</item>
    <item name="storageConfig" xsi:type="array">
    <item name="provider" xsi:type="string">customer_listing.customer_listing.listing_top.bookmarks</item>
    <item name="namespace" xsi:type="string">current.search</item>
    </item>
    </item>
    </argument>
    </filterSearch>
    <filters name="listing_filters">
    <argument name="data" xsi:type="array">
    <item name="config" xsi:type="array">
    <item name="columnsProvider" xsi:type="string">customer_listing.customer_listing.customer_columns</item>
    <item name="storageConfig" xsi:type="array">
    <item name="provider" xsi:type="string">customer_listing.customer_listing.listing_top.bookmarks</item>
    <item name="namespace" xsi:type="string">current.filters</item>
    </item>
    <item name="childDefaults" xsi:type="array">
    <item name="provider" xsi:type="string">customer_listing.customer_listing.listing_top.listing_filters</item>
    <item name="imports" xsi:type="array">
    <item name="visible" xsi:type="string">customer_listing.customer_listing.customer_columns.${ $.index }:visible</item>
    </item>
    </item>
    </item>
    </argument>
    </filters>
    <massaction name="listing_massaction">
    <argument name="data" xsi:type="array">
    <item name="config" xsi:type="array">
    <item name="selectProvider" xsi:type="string">customer_listing.customer_listing.customer_columns.ids</item>
    <item name="component" xsi:type="string">Magento_Ui/js/grid/tree-massactions</item>
    <item name="indexField" xsi:type="string">entity_id</item>
    </item>
    </argument>
    <action name="delete">
    <argument name="data" xsi:type="array">
    <item name="config" xsi:type="array">
    <item name="type" xsi:type="string">delete</item>
    <item name="label" xsi:type="string" translate="true">Delete</item>
    <item name="url" xsi:type="url" path="customer/index/massDelete"/>
    <item name="confirm" xsi:type="array">
    <item name="title" xsi:type="string" translate="true">Delete items</item>
    <item name="message" xsi:type="string" translate="true">Are you sure to delete selected customers?</item>
    </item>
    </item>
    </argument>
    </action>
    <action name="subscribe">
    <argument name="data" xsi:type="array">
    <item name="config" xsi:type="array">
    <item name="type" xsi:type="string">subscribe</item>
    <item name="label" xsi:type="string" translate="true">Subscribe to Newsletter</item>
    <item name="url" xsi:type="url" path="customer/index/massSubscribe"/>
    </item>
    </argument>
    </action>
    <action name="unsubscribe">
    <argument name="data" xsi:type="array">
    <item name="config" xsi:type="array">
    <item name="type" xsi:type="string">unsubscribe</item>
    <item name="label" xsi:type="string" translate="true">Unsubscribe from Newsletter</item>
    <item name="url" xsi:type="url" path="customer/index/massUnsubscribe"/>
    <item name="confirm" xsi:type="array">
    <item name="title" xsi:type="string" translate="true">Unsubscribe from Newsletter</item>
    <item name="message" xsi:type="string" translate="true">Are you sure to unsubscribe selected customers from newsletter?</item>
    </item>
    </item>
    </argument>
    </action>
    <action name="assign_to_group">
    <argument name="data" xsi:type="array">
    <item name="config" xsi:type="array">
    <item name="type" xsi:type="string">assign_to_group</item>
    <item name="label" xsi:type="string" translate="true">Assign a Customer Group</item>
    </item>
    </argument>
    ................................
    ...................................
    </listing>


    When I removed "Add New Customer" by remove some code in this xml file:



    <argument name="data" xsi:type="array">
    <item name="js_config" xsi:type="array">
    <item name="provider" xsi:type="string">customer_listing.customer_listing_data_source</item>
    <item name="deps" xsi:type="string">customer_listing.customer_listing_data_source</item>
    </item>
    <item name="spinner" xsi:type="string">customer_columns</item>
    <item name="buttons" xsi:type="array" >
    <item name="add" xsi:type="array">
    <item name="name" xsi:type="string">add</item>
    <item name="label" xsi:type="string" translate="true">Add New Customer</item>
    <item name="class" xsi:type="string">primary</item>
    <item name="url" xsi:type="string">*/*/new</item>
    <item name="style" xsi:type="string">display:none</item>
    </item>
    </item>
    </argument>


    But it reused original core layout,Anyone know, show me pls!Thanks!










    share|improve this question



























      1












      1








      1


      1






      How to remove "Add New Customer" in Index Admin Customer:
      enter image description here



      I created a new module:

      Create 2 file:

      1) NameSpace/Module/view/adminhtml/layout/customer_index_index.xml



      <?xml version="1.0" encoding="UTF-8"?>
      <referenceContainer name="content">
      <uiComponent name="customer_listing">
      </uiComponent>
      </referenceContainer>


      2) NameSpace/Module/view/adminhtml/ui_component/customer_listing.xml



      <?xml version="1.0" encoding="UTF-8"?>
      <!--
      /**
      * Copyright © 2015 Magento. All rights reserved.
      * See COPYING.txt for license details.
      */
      -->
      <listing xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:module:Magento_Ui:etc/ui_configuration.xsd">
      <argument name="data" xsi:type="array">
      <item name="js_config" xsi:type="array">
      <item name="provider" xsi:type="string">customer_listing.customer_listing_data_source</item>
      <item name="deps" xsi:type="string">customer_listing.customer_listing_data_source</item>
      </item>
      <item name="spinner" xsi:type="string">customer_columns</item>
      <item name="buttons" xsi:type="array" >
      <item name="add" xsi:type="array">
      <item name="name" xsi:type="string">add</item>
      <item name="label" xsi:type="string" translate="true">Add New Customer</item>
      <item name="class" xsi:type="string">primary</item>
      <item name="url" xsi:type="string">*/*/new</item>
      <item name="style" xsi:type="string">display:none</item>
      </item>
      </item>
      </argument>
      <dataSource name="customer_listing_data_source">
      <argument name="dataProvider" xsi:type="configurableObject">
      <argument name="class" xsi:type="string">MagentoCustomerUiComponentDataProvider</argument>
      <argument name="name" xsi:type="string">customer_listing_data_source</argument>
      <argument name="primaryFieldName" xsi:type="string">entity_id</argument>
      <argument name="requestFieldName" xsi:type="string">id</argument>
      <argument name="data" xsi:type="array">
      <item name="config" xsi:type="array">
      <item name="update_url" xsi:type="url" path="mui/index/render"/>
      </item>
      </argument>
      </argument>
      <argument name="data" xsi:type="array">
      <item name="js_config" xsi:type="array">
      <item name="component" xsi:type="string">Magento_Ui/js/grid/provider</item>
      </item>
      </argument>
      </dataSource>
      <container name="listing_top">
      <argument name="data" xsi:type="array">
      <item name="config" xsi:type="array">
      <item name="template" xsi:type="string">ui/grid/toolbar</item>
      </item>
      </argument>
      <bookmark name="bookmarks">
      <argument name="data" xsi:type="array">
      <item name="config" xsi:type="array">
      <item name="storageConfig" xsi:type="array">
      <item name="namespace" xsi:type="string">customer_listing</item>
      </item>
      </item>
      </argument>
      </bookmark>
      <component name="columns_controls">
      <argument name="data" xsi:type="array">
      <item name="config" xsi:type="array">
      <item name="columnsData" xsi:type="array">
      <item name="provider" xsi:type="string">customer_listing.customer_listing.customer_columns</item>
      </item>
      <item name="component" xsi:type="string">Magento_Ui/js/grid/controls/columns</item>
      <item name="displayArea" xsi:type="string">dataGridActions</item>
      </item>
      </argument>
      </component>
      <exportButton name="export_button">
      <argument name="data" xsi:type="array">
      <item name="config" xsi:type="array">
      <item name="selectProvider" xsi:type="string">customer_listing.customer_listing.customer_columns.ids</item>
      </item>
      </argument>
      </exportButton>
      <filterSearch name="fulltext">
      <argument name="data" xsi:type="array">
      <item name="config" xsi:type="array">
      <item name="provider" xsi:type="string">customer_listing.customer_listing_data_source</item>
      <item name="chipsProvider" xsi:type="string">customer_listing.customer_listing.listing_top.listing_filters_chips</item>
      <item name="storageConfig" xsi:type="array">
      <item name="provider" xsi:type="string">customer_listing.customer_listing.listing_top.bookmarks</item>
      <item name="namespace" xsi:type="string">current.search</item>
      </item>
      </item>
      </argument>
      </filterSearch>
      <filters name="listing_filters">
      <argument name="data" xsi:type="array">
      <item name="config" xsi:type="array">
      <item name="columnsProvider" xsi:type="string">customer_listing.customer_listing.customer_columns</item>
      <item name="storageConfig" xsi:type="array">
      <item name="provider" xsi:type="string">customer_listing.customer_listing.listing_top.bookmarks</item>
      <item name="namespace" xsi:type="string">current.filters</item>
      </item>
      <item name="childDefaults" xsi:type="array">
      <item name="provider" xsi:type="string">customer_listing.customer_listing.listing_top.listing_filters</item>
      <item name="imports" xsi:type="array">
      <item name="visible" xsi:type="string">customer_listing.customer_listing.customer_columns.${ $.index }:visible</item>
      </item>
      </item>
      </item>
      </argument>
      </filters>
      <massaction name="listing_massaction">
      <argument name="data" xsi:type="array">
      <item name="config" xsi:type="array">
      <item name="selectProvider" xsi:type="string">customer_listing.customer_listing.customer_columns.ids</item>
      <item name="component" xsi:type="string">Magento_Ui/js/grid/tree-massactions</item>
      <item name="indexField" xsi:type="string">entity_id</item>
      </item>
      </argument>
      <action name="delete">
      <argument name="data" xsi:type="array">
      <item name="config" xsi:type="array">
      <item name="type" xsi:type="string">delete</item>
      <item name="label" xsi:type="string" translate="true">Delete</item>
      <item name="url" xsi:type="url" path="customer/index/massDelete"/>
      <item name="confirm" xsi:type="array">
      <item name="title" xsi:type="string" translate="true">Delete items</item>
      <item name="message" xsi:type="string" translate="true">Are you sure to delete selected customers?</item>
      </item>
      </item>
      </argument>
      </action>
      <action name="subscribe">
      <argument name="data" xsi:type="array">
      <item name="config" xsi:type="array">
      <item name="type" xsi:type="string">subscribe</item>
      <item name="label" xsi:type="string" translate="true">Subscribe to Newsletter</item>
      <item name="url" xsi:type="url" path="customer/index/massSubscribe"/>
      </item>
      </argument>
      </action>
      <action name="unsubscribe">
      <argument name="data" xsi:type="array">
      <item name="config" xsi:type="array">
      <item name="type" xsi:type="string">unsubscribe</item>
      <item name="label" xsi:type="string" translate="true">Unsubscribe from Newsletter</item>
      <item name="url" xsi:type="url" path="customer/index/massUnsubscribe"/>
      <item name="confirm" xsi:type="array">
      <item name="title" xsi:type="string" translate="true">Unsubscribe from Newsletter</item>
      <item name="message" xsi:type="string" translate="true">Are you sure to unsubscribe selected customers from newsletter?</item>
      </item>
      </item>
      </argument>
      </action>
      <action name="assign_to_group">
      <argument name="data" xsi:type="array">
      <item name="config" xsi:type="array">
      <item name="type" xsi:type="string">assign_to_group</item>
      <item name="label" xsi:type="string" translate="true">Assign a Customer Group</item>
      </item>
      </argument>
      ................................
      ...................................
      </listing>


      When I removed "Add New Customer" by remove some code in this xml file:



      <argument name="data" xsi:type="array">
      <item name="js_config" xsi:type="array">
      <item name="provider" xsi:type="string">customer_listing.customer_listing_data_source</item>
      <item name="deps" xsi:type="string">customer_listing.customer_listing_data_source</item>
      </item>
      <item name="spinner" xsi:type="string">customer_columns</item>
      <item name="buttons" xsi:type="array" >
      <item name="add" xsi:type="array">
      <item name="name" xsi:type="string">add</item>
      <item name="label" xsi:type="string" translate="true">Add New Customer</item>
      <item name="class" xsi:type="string">primary</item>
      <item name="url" xsi:type="string">*/*/new</item>
      <item name="style" xsi:type="string">display:none</item>
      </item>
      </item>
      </argument>


      But it reused original core layout,Anyone know, show me pls!Thanks!










      share|improve this question
















      How to remove "Add New Customer" in Index Admin Customer:
      enter image description here



      I created a new module:

      Create 2 file:

      1) NameSpace/Module/view/adminhtml/layout/customer_index_index.xml



      <?xml version="1.0" encoding="UTF-8"?>
      <referenceContainer name="content">
      <uiComponent name="customer_listing">
      </uiComponent>
      </referenceContainer>


      2) NameSpace/Module/view/adminhtml/ui_component/customer_listing.xml



      <?xml version="1.0" encoding="UTF-8"?>
      <!--
      /**
      * Copyright © 2015 Magento. All rights reserved.
      * See COPYING.txt for license details.
      */
      -->
      <listing xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:module:Magento_Ui:etc/ui_configuration.xsd">
      <argument name="data" xsi:type="array">
      <item name="js_config" xsi:type="array">
      <item name="provider" xsi:type="string">customer_listing.customer_listing_data_source</item>
      <item name="deps" xsi:type="string">customer_listing.customer_listing_data_source</item>
      </item>
      <item name="spinner" xsi:type="string">customer_columns</item>
      <item name="buttons" xsi:type="array" >
      <item name="add" xsi:type="array">
      <item name="name" xsi:type="string">add</item>
      <item name="label" xsi:type="string" translate="true">Add New Customer</item>
      <item name="class" xsi:type="string">primary</item>
      <item name="url" xsi:type="string">*/*/new</item>
      <item name="style" xsi:type="string">display:none</item>
      </item>
      </item>
      </argument>
      <dataSource name="customer_listing_data_source">
      <argument name="dataProvider" xsi:type="configurableObject">
      <argument name="class" xsi:type="string">MagentoCustomerUiComponentDataProvider</argument>
      <argument name="name" xsi:type="string">customer_listing_data_source</argument>
      <argument name="primaryFieldName" xsi:type="string">entity_id</argument>
      <argument name="requestFieldName" xsi:type="string">id</argument>
      <argument name="data" xsi:type="array">
      <item name="config" xsi:type="array">
      <item name="update_url" xsi:type="url" path="mui/index/render"/>
      </item>
      </argument>
      </argument>
      <argument name="data" xsi:type="array">
      <item name="js_config" xsi:type="array">
      <item name="component" xsi:type="string">Magento_Ui/js/grid/provider</item>
      </item>
      </argument>
      </dataSource>
      <container name="listing_top">
      <argument name="data" xsi:type="array">
      <item name="config" xsi:type="array">
      <item name="template" xsi:type="string">ui/grid/toolbar</item>
      </item>
      </argument>
      <bookmark name="bookmarks">
      <argument name="data" xsi:type="array">
      <item name="config" xsi:type="array">
      <item name="storageConfig" xsi:type="array">
      <item name="namespace" xsi:type="string">customer_listing</item>
      </item>
      </item>
      </argument>
      </bookmark>
      <component name="columns_controls">
      <argument name="data" xsi:type="array">
      <item name="config" xsi:type="array">
      <item name="columnsData" xsi:type="array">
      <item name="provider" xsi:type="string">customer_listing.customer_listing.customer_columns</item>
      </item>
      <item name="component" xsi:type="string">Magento_Ui/js/grid/controls/columns</item>
      <item name="displayArea" xsi:type="string">dataGridActions</item>
      </item>
      </argument>
      </component>
      <exportButton name="export_button">
      <argument name="data" xsi:type="array">
      <item name="config" xsi:type="array">
      <item name="selectProvider" xsi:type="string">customer_listing.customer_listing.customer_columns.ids</item>
      </item>
      </argument>
      </exportButton>
      <filterSearch name="fulltext">
      <argument name="data" xsi:type="array">
      <item name="config" xsi:type="array">
      <item name="provider" xsi:type="string">customer_listing.customer_listing_data_source</item>
      <item name="chipsProvider" xsi:type="string">customer_listing.customer_listing.listing_top.listing_filters_chips</item>
      <item name="storageConfig" xsi:type="array">
      <item name="provider" xsi:type="string">customer_listing.customer_listing.listing_top.bookmarks</item>
      <item name="namespace" xsi:type="string">current.search</item>
      </item>
      </item>
      </argument>
      </filterSearch>
      <filters name="listing_filters">
      <argument name="data" xsi:type="array">
      <item name="config" xsi:type="array">
      <item name="columnsProvider" xsi:type="string">customer_listing.customer_listing.customer_columns</item>
      <item name="storageConfig" xsi:type="array">
      <item name="provider" xsi:type="string">customer_listing.customer_listing.listing_top.bookmarks</item>
      <item name="namespace" xsi:type="string">current.filters</item>
      </item>
      <item name="childDefaults" xsi:type="array">
      <item name="provider" xsi:type="string">customer_listing.customer_listing.listing_top.listing_filters</item>
      <item name="imports" xsi:type="array">
      <item name="visible" xsi:type="string">customer_listing.customer_listing.customer_columns.${ $.index }:visible</item>
      </item>
      </item>
      </item>
      </argument>
      </filters>
      <massaction name="listing_massaction">
      <argument name="data" xsi:type="array">
      <item name="config" xsi:type="array">
      <item name="selectProvider" xsi:type="string">customer_listing.customer_listing.customer_columns.ids</item>
      <item name="component" xsi:type="string">Magento_Ui/js/grid/tree-massactions</item>
      <item name="indexField" xsi:type="string">entity_id</item>
      </item>
      </argument>
      <action name="delete">
      <argument name="data" xsi:type="array">
      <item name="config" xsi:type="array">
      <item name="type" xsi:type="string">delete</item>
      <item name="label" xsi:type="string" translate="true">Delete</item>
      <item name="url" xsi:type="url" path="customer/index/massDelete"/>
      <item name="confirm" xsi:type="array">
      <item name="title" xsi:type="string" translate="true">Delete items</item>
      <item name="message" xsi:type="string" translate="true">Are you sure to delete selected customers?</item>
      </item>
      </item>
      </argument>
      </action>
      <action name="subscribe">
      <argument name="data" xsi:type="array">
      <item name="config" xsi:type="array">
      <item name="type" xsi:type="string">subscribe</item>
      <item name="label" xsi:type="string" translate="true">Subscribe to Newsletter</item>
      <item name="url" xsi:type="url" path="customer/index/massSubscribe"/>
      </item>
      </argument>
      </action>
      <action name="unsubscribe">
      <argument name="data" xsi:type="array">
      <item name="config" xsi:type="array">
      <item name="type" xsi:type="string">unsubscribe</item>
      <item name="label" xsi:type="string" translate="true">Unsubscribe from Newsletter</item>
      <item name="url" xsi:type="url" path="customer/index/massUnsubscribe"/>
      <item name="confirm" xsi:type="array">
      <item name="title" xsi:type="string" translate="true">Unsubscribe from Newsletter</item>
      <item name="message" xsi:type="string" translate="true">Are you sure to unsubscribe selected customers from newsletter?</item>
      </item>
      </item>
      </argument>
      </action>
      <action name="assign_to_group">
      <argument name="data" xsi:type="array">
      <item name="config" xsi:type="array">
      <item name="type" xsi:type="string">assign_to_group</item>
      <item name="label" xsi:type="string" translate="true">Assign a Customer Group</item>
      </item>
      </argument>
      ................................
      ...................................
      </listing>


      When I removed "Add New Customer" by remove some code in this xml file:



      <argument name="data" xsi:type="array">
      <item name="js_config" xsi:type="array">
      <item name="provider" xsi:type="string">customer_listing.customer_listing_data_source</item>
      <item name="deps" xsi:type="string">customer_listing.customer_listing_data_source</item>
      </item>
      <item name="spinner" xsi:type="string">customer_columns</item>
      <item name="buttons" xsi:type="array" >
      <item name="add" xsi:type="array">
      <item name="name" xsi:type="string">add</item>
      <item name="label" xsi:type="string" translate="true">Add New Customer</item>
      <item name="class" xsi:type="string">primary</item>
      <item name="url" xsi:type="string">*/*/new</item>
      <item name="style" xsi:type="string">display:none</item>
      </item>
      </item>
      </argument>


      But it reused original core layout,Anyone know, show me pls!Thanks!







      magento2 customer custom-options






      share|improve this question















      share|improve this question













      share|improve this question




      share|improve this question








      edited Mar 2 '16 at 8:06







      MrTo-Kane

















      asked Mar 2 '16 at 7:34









      MrTo-KaneMrTo-Kane

      1,73162364




      1,73162364






















          3 Answers
          3






          active

          oldest

          votes


















          3














          Add



          <item name="componentDisabled" xsi:type="boolean">true</item>


          to



           <item name="add" xsi:type="array">
          </item>





          share|improve this answer
























          • I tried but it not change anything .

            – MrTo-Kane
            Mar 3 '16 at 2:11











          • Yes! I remove all content in : <item name="add" xsi:type="array"> </item> and paste : <item name="componentDisabled" xsi:type="boolean">true</item> then it worked ! Thanks @Arkadii Chyzhov !

            – MrTo-Kane
            Mar 3 '16 at 2:31











          • I tried to remove "company" field from checkout but had no success. Could you help? <item name="company" xsi:type="array"> <item name="config" xsi:type="array"> <item name="componentDisabled" xsi:type="boolean">true</item> </item> </item>

            – Luis Garcia
            May 18 '16 at 21:48





















          0














          Rename customer_listing.xml to customer_custom_listing.xml and also update the new filename in NameSpace/Module/view/adminhtml/layout/customer_index_index.xml



           <?xml version="1.0" encoding="UTF-8"?>
          <referenceContainer name="content">
          <uiComponent name="customer_custom_listing">
          </uiComponent>
          </referenceContainer>


          Now you can delete the below lines from customer_custom_listing.xml to remove the button.



          <item name="buttons" xsi:type="array" >
          <item name="add" xsi:type="array">
          <item name="name" xsi:type="string">add</item>
          <item name="label" xsi:type="string" translate="true">Add New Customer</item>
          <item name="class" xsi:type="string">primary</item>
          <item name="url" xsi:type="string">*/*/new</item>
          <item name="style" xsi:type="string">display:none</item>
          </item>
          </item>





          share|improve this answer
























          • I tried to do this way, but it not remove button, and it generate button of original layout.

            – MrTo-Kane
            Mar 3 '16 at 2:12



















          0














          – Go to YourNamespace/YourModule/Block/Adminhtml/addButton.php
          – Add the following code in the constructor of this file (it should be just below the call to parent constructor



          parent::__construct(); 
          $this->_removeButton('add');




          share























            Your Answer








            StackExchange.ready(function() {
            var channelOptions = {
            tags: "".split(" "),
            id: "479"
            };
            initTagRenderer("".split(" "), "".split(" "), channelOptions);

            StackExchange.using("externalEditor", function() {
            // Have to fire editor after snippets, if snippets enabled
            if (StackExchange.settings.snippets.snippetsEnabled) {
            StackExchange.using("snippets", function() {
            createEditor();
            });
            }
            else {
            createEditor();
            }
            });

            function createEditor() {
            StackExchange.prepareEditor({
            heartbeatType: 'answer',
            autoActivateHeartbeat: false,
            convertImagesToLinks: false,
            noModals: true,
            showLowRepImageUploadWarning: true,
            reputationToPostImages: null,
            bindNavPrevention: true,
            postfix: "",
            imageUploader: {
            brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
            contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
            allowUrls: true
            },
            onDemand: true,
            discardSelector: ".discard-answer"
            ,immediatelyShowMarkdownHelp:true
            });


            }
            });














            draft saved

            draft discarded


















            StackExchange.ready(
            function () {
            StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fmagento.stackexchange.com%2fquestions%2f104259%2fmagento-2-how-to-remove-add-new-customer-button-in-index-admin-customer%23new-answer', 'question_page');
            }
            );

            Post as a guest















            Required, but never shown

























            3 Answers
            3






            active

            oldest

            votes








            3 Answers
            3






            active

            oldest

            votes









            active

            oldest

            votes






            active

            oldest

            votes









            3














            Add



            <item name="componentDisabled" xsi:type="boolean">true</item>


            to



             <item name="add" xsi:type="array">
            </item>





            share|improve this answer
























            • I tried but it not change anything .

              – MrTo-Kane
              Mar 3 '16 at 2:11











            • Yes! I remove all content in : <item name="add" xsi:type="array"> </item> and paste : <item name="componentDisabled" xsi:type="boolean">true</item> then it worked ! Thanks @Arkadii Chyzhov !

              – MrTo-Kane
              Mar 3 '16 at 2:31











            • I tried to remove "company" field from checkout but had no success. Could you help? <item name="company" xsi:type="array"> <item name="config" xsi:type="array"> <item name="componentDisabled" xsi:type="boolean">true</item> </item> </item>

              – Luis Garcia
              May 18 '16 at 21:48


















            3














            Add



            <item name="componentDisabled" xsi:type="boolean">true</item>


            to



             <item name="add" xsi:type="array">
            </item>





            share|improve this answer
























            • I tried but it not change anything .

              – MrTo-Kane
              Mar 3 '16 at 2:11











            • Yes! I remove all content in : <item name="add" xsi:type="array"> </item> and paste : <item name="componentDisabled" xsi:type="boolean">true</item> then it worked ! Thanks @Arkadii Chyzhov !

              – MrTo-Kane
              Mar 3 '16 at 2:31











            • I tried to remove "company" field from checkout but had no success. Could you help? <item name="company" xsi:type="array"> <item name="config" xsi:type="array"> <item name="componentDisabled" xsi:type="boolean">true</item> </item> </item>

              – Luis Garcia
              May 18 '16 at 21:48
















            3












            3








            3







            Add



            <item name="componentDisabled" xsi:type="boolean">true</item>


            to



             <item name="add" xsi:type="array">
            </item>





            share|improve this answer













            Add



            <item name="componentDisabled" xsi:type="boolean">true</item>


            to



             <item name="add" xsi:type="array">
            </item>






            share|improve this answer












            share|improve this answer



            share|improve this answer










            answered Mar 2 '16 at 9:57









            Arkadii ChyzhovArkadii Chyzhov

            2,418714




            2,418714













            • I tried but it not change anything .

              – MrTo-Kane
              Mar 3 '16 at 2:11











            • Yes! I remove all content in : <item name="add" xsi:type="array"> </item> and paste : <item name="componentDisabled" xsi:type="boolean">true</item> then it worked ! Thanks @Arkadii Chyzhov !

              – MrTo-Kane
              Mar 3 '16 at 2:31











            • I tried to remove "company" field from checkout but had no success. Could you help? <item name="company" xsi:type="array"> <item name="config" xsi:type="array"> <item name="componentDisabled" xsi:type="boolean">true</item> </item> </item>

              – Luis Garcia
              May 18 '16 at 21:48





















            • I tried but it not change anything .

              – MrTo-Kane
              Mar 3 '16 at 2:11











            • Yes! I remove all content in : <item name="add" xsi:type="array"> </item> and paste : <item name="componentDisabled" xsi:type="boolean">true</item> then it worked ! Thanks @Arkadii Chyzhov !

              – MrTo-Kane
              Mar 3 '16 at 2:31











            • I tried to remove "company" field from checkout but had no success. Could you help? <item name="company" xsi:type="array"> <item name="config" xsi:type="array"> <item name="componentDisabled" xsi:type="boolean">true</item> </item> </item>

              – Luis Garcia
              May 18 '16 at 21:48



















            I tried but it not change anything .

            – MrTo-Kane
            Mar 3 '16 at 2:11





            I tried but it not change anything .

            – MrTo-Kane
            Mar 3 '16 at 2:11













            Yes! I remove all content in : <item name="add" xsi:type="array"> </item> and paste : <item name="componentDisabled" xsi:type="boolean">true</item> then it worked ! Thanks @Arkadii Chyzhov !

            – MrTo-Kane
            Mar 3 '16 at 2:31





            Yes! I remove all content in : <item name="add" xsi:type="array"> </item> and paste : <item name="componentDisabled" xsi:type="boolean">true</item> then it worked ! Thanks @Arkadii Chyzhov !

            – MrTo-Kane
            Mar 3 '16 at 2:31













            I tried to remove "company" field from checkout but had no success. Could you help? <item name="company" xsi:type="array"> <item name="config" xsi:type="array"> <item name="componentDisabled" xsi:type="boolean">true</item> </item> </item>

            – Luis Garcia
            May 18 '16 at 21:48







            I tried to remove "company" field from checkout but had no success. Could you help? <item name="company" xsi:type="array"> <item name="config" xsi:type="array"> <item name="componentDisabled" xsi:type="boolean">true</item> </item> </item>

            – Luis Garcia
            May 18 '16 at 21:48















            0














            Rename customer_listing.xml to customer_custom_listing.xml and also update the new filename in NameSpace/Module/view/adminhtml/layout/customer_index_index.xml



             <?xml version="1.0" encoding="UTF-8"?>
            <referenceContainer name="content">
            <uiComponent name="customer_custom_listing">
            </uiComponent>
            </referenceContainer>


            Now you can delete the below lines from customer_custom_listing.xml to remove the button.



            <item name="buttons" xsi:type="array" >
            <item name="add" xsi:type="array">
            <item name="name" xsi:type="string">add</item>
            <item name="label" xsi:type="string" translate="true">Add New Customer</item>
            <item name="class" xsi:type="string">primary</item>
            <item name="url" xsi:type="string">*/*/new</item>
            <item name="style" xsi:type="string">display:none</item>
            </item>
            </item>





            share|improve this answer
























            • I tried to do this way, but it not remove button, and it generate button of original layout.

              – MrTo-Kane
              Mar 3 '16 at 2:12
















            0














            Rename customer_listing.xml to customer_custom_listing.xml and also update the new filename in NameSpace/Module/view/adminhtml/layout/customer_index_index.xml



             <?xml version="1.0" encoding="UTF-8"?>
            <referenceContainer name="content">
            <uiComponent name="customer_custom_listing">
            </uiComponent>
            </referenceContainer>


            Now you can delete the below lines from customer_custom_listing.xml to remove the button.



            <item name="buttons" xsi:type="array" >
            <item name="add" xsi:type="array">
            <item name="name" xsi:type="string">add</item>
            <item name="label" xsi:type="string" translate="true">Add New Customer</item>
            <item name="class" xsi:type="string">primary</item>
            <item name="url" xsi:type="string">*/*/new</item>
            <item name="style" xsi:type="string">display:none</item>
            </item>
            </item>





            share|improve this answer
























            • I tried to do this way, but it not remove button, and it generate button of original layout.

              – MrTo-Kane
              Mar 3 '16 at 2:12














            0












            0








            0







            Rename customer_listing.xml to customer_custom_listing.xml and also update the new filename in NameSpace/Module/view/adminhtml/layout/customer_index_index.xml



             <?xml version="1.0" encoding="UTF-8"?>
            <referenceContainer name="content">
            <uiComponent name="customer_custom_listing">
            </uiComponent>
            </referenceContainer>


            Now you can delete the below lines from customer_custom_listing.xml to remove the button.



            <item name="buttons" xsi:type="array" >
            <item name="add" xsi:type="array">
            <item name="name" xsi:type="string">add</item>
            <item name="label" xsi:type="string" translate="true">Add New Customer</item>
            <item name="class" xsi:type="string">primary</item>
            <item name="url" xsi:type="string">*/*/new</item>
            <item name="style" xsi:type="string">display:none</item>
            </item>
            </item>





            share|improve this answer













            Rename customer_listing.xml to customer_custom_listing.xml and also update the new filename in NameSpace/Module/view/adminhtml/layout/customer_index_index.xml



             <?xml version="1.0" encoding="UTF-8"?>
            <referenceContainer name="content">
            <uiComponent name="customer_custom_listing">
            </uiComponent>
            </referenceContainer>


            Now you can delete the below lines from customer_custom_listing.xml to remove the button.



            <item name="buttons" xsi:type="array" >
            <item name="add" xsi:type="array">
            <item name="name" xsi:type="string">add</item>
            <item name="label" xsi:type="string" translate="true">Add New Customer</item>
            <item name="class" xsi:type="string">primary</item>
            <item name="url" xsi:type="string">*/*/new</item>
            <item name="style" xsi:type="string">display:none</item>
            </item>
            </item>






            share|improve this answer












            share|improve this answer



            share|improve this answer










            answered Mar 2 '16 at 9:53









            MikeMike

            963412




            963412













            • I tried to do this way, but it not remove button, and it generate button of original layout.

              – MrTo-Kane
              Mar 3 '16 at 2:12



















            • I tried to do this way, but it not remove button, and it generate button of original layout.

              – MrTo-Kane
              Mar 3 '16 at 2:12

















            I tried to do this way, but it not remove button, and it generate button of original layout.

            – MrTo-Kane
            Mar 3 '16 at 2:12





            I tried to do this way, but it not remove button, and it generate button of original layout.

            – MrTo-Kane
            Mar 3 '16 at 2:12











            0














            – Go to YourNamespace/YourModule/Block/Adminhtml/addButton.php
            – Add the following code in the constructor of this file (it should be just below the call to parent constructor



            parent::__construct(); 
            $this->_removeButton('add');




            share




























              0














              – Go to YourNamespace/YourModule/Block/Adminhtml/addButton.php
              – Add the following code in the constructor of this file (it should be just below the call to parent constructor



              parent::__construct(); 
              $this->_removeButton('add');




              share


























                0












                0








                0







                – Go to YourNamespace/YourModule/Block/Adminhtml/addButton.php
                – Add the following code in the constructor of this file (it should be just below the call to parent constructor



                parent::__construct(); 
                $this->_removeButton('add');




                share













                – Go to YourNamespace/YourModule/Block/Adminhtml/addButton.php
                – Add the following code in the constructor of this file (it should be just below the call to parent constructor



                parent::__construct(); 
                $this->_removeButton('add');





                share











                share


                share










                answered 3 mins ago









                Magento DevMagento Dev

                285




                285






























                    draft saved

                    draft discarded




















































                    Thanks for contributing an answer to Magento Stack Exchange!


                    • Please be sure to answer the question. Provide details and share your research!

                    But avoid



                    • Asking for help, clarification, or responding to other answers.

                    • Making statements based on opinion; back them up with references or personal experience.


                    To learn more, see our tips on writing great answers.




                    draft saved


                    draft discarded














                    StackExchange.ready(
                    function () {
                    StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fmagento.stackexchange.com%2fquestions%2f104259%2fmagento-2-how-to-remove-add-new-customer-button-in-index-admin-customer%23new-answer', 'question_page');
                    }
                    );

                    Post as a guest















                    Required, but never shown





















































                    Required, but never shown














                    Required, but never shown












                    Required, but never shown







                    Required, but never shown

































                    Required, but never shown














                    Required, but never shown












                    Required, but never shown







                    Required, but never shown







                    Popular posts from this blog

                    What other Star Trek series did the main TNG cast show up in?

                    Berlina muro

                    Berlina aerponto