Magento 2 customer grid inline edit how to disable specifc column
-
15-04-2021 - |
해결책
You can disable it by overriding ui_component file customer_listing.xml
.
path: Vendor/Module/view/adminhtml/ui_component/customer_listing.xml
try below code.
<?xml version="1.0" encoding="UTF-8"?>
<listing xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:module:Magento_Ui:etc/ui_configuration.xsd">
<columns name="customer_columns" class="Magento\Customer\Ui\Component\Listing\Columns">
<column name="email" sortOrder="40">
<settings>
<editor>
<editorType>false</editorType>
</editor>
</settings>
</column>
</columns>
</listing>
After this clear your cache.
다른 팁
If you are asking about your own component, then you can open the grid and learn from Magento itself. Or search here, many articles are available.
Here is an example link: Set inline edit disable for certain field
In case you want to disable core module. You can follow my steps here:
I tried to overwrite via xml but it doesn't work. So If anyone has a solution using layout, kindly let me know.
My solution uses Javascript.
- You need to overwrite the column. Here I take
email
as an example. Use the code below in your owncustomer_listing.xml
file
Just to make use of the component, here in this case: Vendor_Module/js/inline_edit
<?xml version="1.0" encoding="UTF-8"?>
<listing xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:module:Magento_Ui:etc/ui_configuration.xsd">
<columns name="customer_columns" class="Magento\Customer\Ui\Component\Listing\Columns">
<column name="email" component="Vendor_Module/js/inline_edit" />
</columns>
</listing>
- In your
Vendor_Module/js/inline_edit
file, paste the following content
define([
'Magento_Ui/js/grid/columns/column'
], function (Column) {
'use strict';
return Column.extend({
initialize: function () {
this._super();
this.editor = {};
return this;
},
});
});
제휴하지 않습니다 magento.stackexchange