lightning:datatable minColumnWidth and maxColumnWidth attributes not working as documented
Last updated 2022-12-13 ·Reference W-4745528 ·Reported By 99 users
In Review
Summary
The lightning:datatable minColumnWidth and maxColumnWidth attributes are not working as documented. The specified widths are ignored
Repro
1. Create the following Lightning Component:
Component
-----------------------------------
<aura:component implements="aura:requireLocker">
<aura:attribute name="mydata" type="Object"/>
<aura:attribute name="mycolumns" type="List"/>
<aura:handler name="init" value="{!this}" action="{!c.init}"/>
<lightning:datatable
data="{!v.mydata}"
columns="{!v.mycolumns}"
keyField="Id"
maxColumnWidth="350"
minColumnWidth="300"
resizeStep="20"
/>
</aura:component>
-----------------------------------
Controller
-----------------------------------
({
init: function (cmp) {
cmp.set('v.mycolumns', [
{label: 'Contact Name', sortable: true, fieldName: 'Name', type: 'text' },
{label: 'Phone', fieldName: 'Phone', type: 'phone' }
]);
cmp.set('v.mydata', [
{ Id: 1, Name: 'John', Phone: '415-982-1234'},
{ Id: 2, Name: 'Jane', Phone: '415-123-2133'}
]);
}
})
-----------------------------------
2. Resize the table columns. Observe that the max (350) and min (300) widths are not applied. The columns are resizable to a minimum of 50px and a maximum of 1000px which are the default values
Workaround
None at this time
Reported By (99)




















Is it Fixed?
Any unreleased services, features, statuses, or dates referenced in this or other public statements are not currently available and may not be delivered on time or at all. Customers who purchase our services should make their purchase decisions based upon features that are currently available.