Conditionally disabling an editable field in lightning Datatable

Salesforce Asked by Mohammed Aiyaz on August 14, 2020

I have a requirement that an editable field in Datatable should be editable on certain conditions for example lets say, i have a field Disable_Action__c which is a formula field , when this field evaluates to false i should be able to edit the field which is there in Datatable.

One Answer

It is not possible to make a field conditionally editable. The way I solved it, was to change the cellattributes conditionally, so I changed the background color to indicate to the user that something is different:

cellAttributes: { class: { fieldName: 'CSS_Class_Quantity__c' } }

But that is not enough, your Javascript code must not take into account the entered data. It would be much easier if editable was conditional, but alas, it isn't at this moment.

Answered by Sander de Jong on August 14, 2020

Add your own answers!

Ask a Question

Get help from others!

© 2024 All rights reserved. Sites we Love: PCI Database, UKBizDB, Menu Kuliner, Sharing RPP