You need to sign in to do that
Don't have an account?
Brian C
Conditional editing in Lightning Datatable
When defining the columns for a Lightning Datatable, is it possible to set the editable property for a column based on data in another column?
Here is what I have for the column definitions currently:
I would like the "cost" field to be editable based on the value in the "status" field. For example, if the status is "Shipped," allow the cost to be edited on that line. If it is any other status, switch that line's cost editable property to false.
I've looked into Validation Rules for setting this criteria on the object in question, but I'd prefer the user to not even see the pencil to edit within the datatable.
Here is what I have for the column definitions currently:
var columns = [ { label: "Ship To", initialWidth: 235, fieldName: "fulfilltype", type: "text" }, { label: "Status", initialWidth: 100, fieldName: "status", type: "text" }, { label: "Cost", fixedWidth: 165, fieldName: "cost", type: "currency", editable: true } ];
I would like the "cost" field to be editable based on the value in the "status" field. For example, if the status is "Shipped," allow the cost to be edited on that line. If it is any other status, switch that line's cost editable property to false.
I've looked into Validation Rules for setting this criteria on the object in question, but I'd prefer the user to not even see the pencil to edit within the datatable.
these are the options
like below