[SalesForce] Make lightning:datatable horizontally scrollable

I have a datatable that can potentially have tons of column, placed inside a limited area.

How can I make it horizontally scrollable?

I've tried wrapping parent container into class="slds-scrollable_x" to no avail.

Best Answer

Columns have a minColumnWidth property. You can set the column min to something you choose (perhaps something that lets you read the title properly). If the added widths of the columns exceed the component's screen size, then the horizontal scroll bar will appear.