How to make the column width be the minimal width possible?
I have a table defined as follows:
<ui5-table class="exchange-table">
<ui5-table-column data-ui5-slot="columns" width="2em" class="exchange-header">
</ui5-table-column>
<ui5-table-column data-ui5-slot="columns" class="exchange-header">
<span data-ui5-slot="header" class="text-center">Location</span>
</ui5-table-column>
<ui5-table-column data-ui5-slot="columns" class="exchange-header">
<span data-ui5-slot="header" class="text-center">From / To</span>
</ui5-table-column>
<ui5-table-column data-ui5-slot="columns" class="exchange-header">
<span data-ui5-slot="header" class="text-center">MOT</span>
</ui5-table-column>
<ui5-table-row data-ui5-slot="rows" v-for="row in rows" :key="row.id">
<ui5-table-cell>
<ui5-button icon="sap-icon://navigation-right-arrow" type="Transparent" >
</ui5-button>
</ui5-table-cell>
<ui5-table-cell>
<span class="text-center">{{row.location}}</span>
</ui5-table-cell>
<ui5-table-cell>
<span class="text-center">{{row.from}} - {{row.to}}</span>
</ui5-table-cell>
<ui5-table-cell>
<span class="text-center">{{row.MOT}}</span>
</ui5-table-cell>
</ui5-table-row>
How do I make the first column width be the minimum width needed for the content in the rows?
It will always be a ui5-button with one Icon.
Hi @Psidium ,
Instead of width="5rem", you can set width="auto" to the column. This way the column will adjust automatically. In your case it is a good idea to give the column a header(like the others) in order to be aligned correctly. You can check out this sample: https://codesandbox.io/s/ui5webcomponents-efq3q
We are interested if you have a use case where you don't need header for a column?
PS: If you are using the latest version: 0.11, instead of data-ui-slot you can use only slot ;)
Best regards, Filip
Thanks, it works.