I have created Inline editing in list using UI Component. The Inline editing works fine.
Now I want to disable certain field from being updated.
How can i implement this in magento 2?
Magento Stack Exchange is a question and answer site for users of the Magento e-Commerce platform. It only takes a minute to sign up.
Sign up to join this communityTry Below code:-
Disable Inline Edit
<column name="field_name" sortOrder="30">
<settings>
<filter>text</filter>
<label translate="true">field_name</label>
</settings>
</column>
If You Want To Apply Inline Edit:-
<column name="field_name" sortOrder="40">
<settings>
<filter>text</filter>
<editor>
<editorType>text</editorType>
</editor>
<label translate="true">field_name</label>
</settings>
</column>
Hope this will work for you.
To disable inline edit,go to ui_component xml file under magento root directory which looks like:
app/code/Vendor/ModuleName/view/adminhtml/ui_component/my_file.xml
<listing xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:module:Magento_Ui:etc/ui_configuration.xsd">
<columns name="mycolumn">
<settings>
<editorConfig>
<param name="enabled" xsi:type="boolean">false</param>
</editorConfig>
</settings>
</columns>
</listing>
As shown above find your column and add settings there.
Hope it helps!
In You Listing File Add Simply This Code For Disable Inline Edit :-
<column name="field_name" sortOrder="70">
<settings>
<label translate="true">Field Lable</label>
</settings>
</column>
If You Want To Apply Inline Edit :-
<column name="field_name">
<argument name="data" xsi:type="array">
<item name="config" xsi:type="array">
<item name="editor" xsi:type="array">
<item name="editorType" xsi:type="string">text</item>
</item>
</item>
</argument>
</column>
Hope this will work for you.
Just Remove the Editor nodes.like
<item name="editor" xsi:type="array">
<item name="editorType" xsi:type="string">text</item>
</item>
from the which columnn you dont need inline edit.
Remove this tag from that column where you want to disable editor.
<editor>
<editorType>date</editorType>
</editor>