I want to add a new column in my existing custom admin grid:
also I want this column to appear in edit listing page.
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 communityIn
view/adminhtml/ui_component/listing.xml
Add this code to create new column.
<column name="name">
<argument name="data" xsi:type="array">
<item name="config" xsi:type="array">
<item name="filter" xsi:type="string">text</item>
<item name="editor" xsi:type="array">
<item name="editorType" xsi:type="string">text</item>
</item>
<item name="label" xsi:type="string" translate="true">Name</item>
<item name="visible" xsi:type="boolean">false</item>
</item>
</argument>
</column>
Also, the name of the column must be the same as the database column field. So it will automatically retrieve data from the database.
The same Thing goes for Editing page. Add the Same Column in Edit form. if you want to create a field in existing database, you need to run UpgradeScheme script for this. https://magento.stackexchange.com/a/238655/66990