cancel
Showing results for 
Search instead for 
Did you mean: 

Magento 2: Unable to change Admin Grid column width

Magento 2: Unable to change Admin Grid column width

I am trying to change the width of columns in my custom admin panel, but it's not working and I cannot find any concrete info on how to do this properly.

 

I'm using the core Magento modules as a base, and here in sales_order_status_index.xml I see:

 

<block class="Magento\Backend\Block\Widget\Grid\Column" as="status">
<arguments>
<argument name="header" xsi:type="string" translate="true">Status Code</argument>
<argument name="index" xsi:type="string">status</argument>
<argument name="type" xsi:type="string">text</argument>
<argument name="filter_index" xsi:type="string">main_table.status</argument>
<argument name="width" xsi:type="string">200</argument>
</arguments>
</block>

 

So in my custom module I copied the structure:

 

<block class="Magento\Backend\Block\Widget\Grid\Column" as="banner-id">
<arguments>
<argument name="header" xsi:type="string" translate="true">ID</argument>
<argument name="type" xsi:type="string">number</argument>
<argument name="id" xsi:type="string">banner-id</argument>
<argument name="index" xsi:type="string">banner_id</argument>
<argument name="width" xsi:type="string">50</argument>
</arguments>
</block>

 But nothing happens, and the column width remains at 100+ px.  What am I doing wrong? 

1 REPLY

Re: Magento 2: Unable to change Admin Grid column width

I get exactly the same - I don't suppose you figured this out?