0

I have a lightning data table with some columns and row-actions. These row actions are configured dynamically on the basis of row data. For example, If I am fetching some Payments data into my table and if the status(column) of a particular record(row) has value 'Paid', then the Row Actions should have 'Refund', 'View Receipt', 'Send Receipt' options available

enter image description here

otherwise if the status is 'Failed' the Row Actions dropdown should not be visible at all :

enter image description here

In my case, I am able to set the criteria for Row Actions but not able to hide the dropdown icon when there are no Row Actions. It has to be done dynamically from JS but I am not able to achieve it.

Code : paymentsTable.html :

enter image description here

=========================================================

paymentsTable.js:

enter image description here enter image description here enter image description here

2
  • just change the config for the column like so {type: 'action', typeAttributes: { rowActions: this.getRowActions }, } and then in getRowActions you can decide what you want – zaitsman Jul 23 '20 at 7:21
  • I have observed that custom css doesn't work with cellAttributes. Can you try using standard styles instead and check? Like slds-hide – Hemant Jain Jul 23 '20 at 7:22
0

You are putting cellAttribute inside typeAttribute both should be separate like this

 typeAttributes: { rowActions: actions},cellAttributes:{class:{fieldName:'cssClass'} }

you can also directly use "slds-hide" class instead of using static resource simply use

cssClass:'slds-hide'

Instead of "hideActionButton"

2
  • Thanks for the response. The solution worked for me. Just one small thing, How can I update the text color of RowActions from Grey to dodger blue. – Gaurav Sharma Jul 23 '20 at 12:12
  • @GauravSharma salesforce.stackexchange.com/questions/305075/… you can try this with slds color classes if you could not find your color then you will have to upload static resource i guess – User6670 Jul 23 '20 at 12:16

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.