function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion
Sumesh ChandranSumesh Chandran 

How to add Lightning:buttongroup as a column in lightning:datatable?

Just a newbie to salesforce development and Javascript as well. I got it done this way, it doesn't seem to show anything. Just taking it step by step
({
    fetchOpps : function(component, event, helper) {
        var actions = [
            {label: 'Overdue', name: 'selectRecord'},
            {label: 'Closed Won', name: 'closedWon'}
        ];
        component.set('v.columns', [
            {type: 'action', typeAttributes: {rowActions: actions}},
            {type: "button", typeAttributes: {
                             iconName: 'utility:add',
                             label: '',
                             name: 'selectRecord',
                             title: 'selectRecord',
                             disabled: false,
                             value: 'test',
            }},
            {type: "buttonGroup", typeAttributes: {
                             iconName: 'action:approval',
                             label: '',
                             name: 'selectRecord',
                             title: 'selectRecord',
                             disabled: false,
                             value: 'test',
            }},
            {type: "button", typeAttributes: {
                             iconName: 'action:approval',
                             label: '',
                             name: 'selectRecord',
                             title: 'selectRecord',
                             disabled: false,
                             value: 'test',
            }},

            {label: 'Opportunity name', fieldName: 'Name', type: 'text'},
            {label: 'Close Date', fieldName: 'CloseDate', type: 'date'},
            {label: 'Stage', fieldName: 'StageName', type: 'picklist'},
        ]);
            helper.fetchOpportunities(component, event, helper);
    },
Please advise!

Thanks
 
Best Answer chosen by Sumesh Chandran
Khan AnasKhan Anas (Salesforce Developers) 

Hi Sumesh,

Greetings to you!

You're trying to use buttonGroup type for the column, which is not supported. You'll want to read the documentation (https://developer.salesforce.com/docs/component-library/bundle/lightning:datatable/documentation). The list of types supported are as follows:
  • action
  • boolean
  • button
  • button-icon
  • currency
  • date
  • date-local
  • email
  • location
  • number
  • percent
  • phone
  • text
  • url

I hope it helps you.

Kindly let me know if it helps you and close your query by marking it as solved so that it can help others in the future.

Thanks and Regards,
Khan Anas

All Answers

Khan AnasKhan Anas (Salesforce Developers) 

Hi Sumesh,

Greetings to you!

You're trying to use buttonGroup type for the column, which is not supported. You'll want to read the documentation (https://developer.salesforce.com/docs/component-library/bundle/lightning:datatable/documentation). The list of types supported are as follows:
  • action
  • boolean
  • button
  • button-icon
  • currency
  • date
  • date-local
  • email
  • location
  • number
  • percent
  • phone
  • text
  • url

I hope it helps you.

Kindly let me know if it helps you and close your query by marking it as solved so that it can help others in the future.

Thanks and Regards,
Khan Anas
This was selected as the best answer
Sumesh ChandranSumesh Chandran
Thanks Khan,

The link you provided helped a lot.