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 

Lightning: Datatable - Button column with title from the server!

Hello,

I am trying to add a button column to a lightning datatable with each button in that column to have the value from the serverCall. I got to this point, but it doesn't display the value. New to Saleforce & Javascript.
<lightning:datatable keyField="id" data="{! v.opps }" columns="{! v.columns }" 
                             hideCheckboxColumn="true" onrowaction="{! c.handleRowAction }"/>
component.set('v.columns', [     
            {label: 'Opportunity name', fieldName: 'Name', type: 'text'},
            {label: 'Close Date', fieldName: 'CloseDate', type: 'date', editable: 'true', cellAttributes: { iconName: 'utility:event', iconAlternativeText: 'Close Date' }},
            {label: 'Action', fieldName: 'StageName', type: 'button', typeAttributes: { iconName: 'utility:view', label: 'View Record', fieldName: 'StageName', name: 'viewRecord', disabled: false, value: 'viewBtn', variant:{fieldName: 'StageName'}}}
		]);

 
Best Answer chosen by Sumesh Chandran
NagendraNagendra (Salesforce Developers) 
Hi Sumesh,

Sorry for this issue you are facing.

May I suggest you please refer to below link from the forums community exactly with a similar discussion which will help you resolve the above issue. Hope this helps.

Kindly mark this as solved if the reply was helpful.

Thanks,
Nagendra

All Answers

NagendraNagendra (Salesforce Developers) 
Hi Sumesh,

Sorry for this issue you are facing.

May I suggest you please refer to below link from the forums community exactly with a similar discussion which will help you resolve the above issue. Hope this helps.

Kindly mark this as solved if the reply was helpful.

Thanks,
Nagendra
This was selected as the best answer
{tushar-sharma}{tushar-sharma}
You can find ready to use lightning data table component example here: This component does support multiple field types, Inline editing, Row-level action with lazy loading. This is a complete reusable component.

 https://newstechnologystuff.com/2019/01/01/lightning-datatable-lazy-loading-with-inline-editing-and-actions/