cancel
Showing results for 
Search instead for 
Did you mean: 

Specify a field different from the name in a grid UI

Specify a field different from the name in a grid UI

Hi,

 

How can I use a different name in a column UI than the table field name?

 

Currently we do something like:

 

<column name="subscriber_id">
<argument name="data" xsi:type="array">
<item name="config" xsi:type="array">
<item name="filter" xsi:type="string">textRange</item> 
<item name="label" xsi:type="string" translate="true">ID</item>
</item>
</argument>
</column>

But, in a edit form with multiple left tabs and grids, we will run into issues because the subscriber_id will be used as a field name for filters. And that will mess up the subscriber_id passed trough the URL.

 

How can we add a column with a name different than the db table name?

 

Regards

2 REPLIES

Re: Specify a field different from the name in a grid UI

How to set a custom name for a Magento 2 backend grid's column: https://mage2.pro/t/547

Re: Specify a field different from the name in a grid UI

That does not work.

 

It won't prevent Magento from naming form fields with the value from getName() and not using the value specified in the XML.

 

It also won't allow multiple columns from the same field, since the last will override the later.