• Lalitha Jakka
  • NEWBIE
  • 0 Points
  • Member since 2020

  • Chatter
    Feed
  • 0
    Best Answers
  • 0
    Likes Received
  • 0
    Likes Given
  • 0
    Questions
  • 1
    Replies
I'm using a lightning:datatable to retreive data and want the date-formatted columns to be right-aligned.  I've figured out how to right-align the actual data, but the column heading is still left-aligned and I can't find any documentation on how to right-align it.

datatable definition:
<lightning:datatable
                keyField="id"
                data="{! v.eeObject.serviceBranches }"
                columns="{! v.serviceColumns }"
                hideCheckboxColumn="true"/>

...and a snippet of the column definition setting the right-align of the data:
component.set('v.serviceColumns', [
    {label: 'Entry Date', fieldName: 'serviceEntryDate', type: 'date-local', 
    typeAttributes:{ month: "numeric", day: "numeric" }, cellAttributes: { alignment: 'right' }},
    {label: 'Exit Date', fieldName: 'serviceExitDate', type: 'date-local', 
    typeAttributes:{ month: "numeric", day: "numeric" }, cellAttributes: { alignment: 'left' }}
]);

Also attaching a picture showing the problem.
Misaligned heading and data in column