Skip to main content
edited title
Link
Olivia
  • 3.5k
  • 11
  • 54
  • 105

Lightning Datatable Picklist and Lookup Work Around

Source Link
Olivia
  • 3.5k
  • 11
  • 54
  • 105

Lightning Datatable Picklist Work Around

I am aware that lightning:datatable does not support picklists.

The approved attributes are:

  • action
  • boolean
  • button
  • button-icon
  • currency
  • date
  • date-local
  • email
  • location
  • number
  • percent
  • phone
  • text
  • url

With that said, I have a need for a picklist value to be visible and editable in my datatable (as I am sure many other people have run into). My question is - has anyone found a good workaround for this blocker yet?

My workaround thought is to use the action button and have a drop down of either hardcoded values or queried values. I am not entirely sure if this is possible as I don't see in the documentation any where that you can define a "default" value like you can with lightning attributes.

Does anyone know if this is possible?

({
    doInit: function (component , event, helper) {
    component.set('v.columns', [
        {label: 'Name', fieldName: 'Name', type: 'text', editable: true, typeAttributes: { required: false }},
        {label: 'Owner Name', fieldName: 'OwnerId.Name', type: 'lookup', editable: true, typeAttributes: { required: false }},
        {label: 'Type', fieldName: 'Type', type: 'action', editable: true, typeAttributes: {rowActions: actions } {defaultValues: 'value1', 'value2'}}, //PICKLIST
        {label: 'Tier', fieldName: 'Tier__c', type: 'action', editable: true, typeAttributes: {rowActions: actions }{defaultValues: 'value3', 'value4'}}, //PICKLIST