I want to conditionally control the inline editing property of the Quantity column.
Followed many posts Conditionally enable edit in lightning:datatable, https://developer.salesforce.com/forums/?id=9062I000000QxLq and many more but to no avail. Here is my css
.testone{
pointer-events: none;
color: #333;
border: 1px solid #666;
background: red;
}
and the Quantity column has the cellAttributes element
{label: labels.quantity, fieldName: 'Quantity', type: 'number', editable : true,
cellAttributes: {
class:{
fieldName: 'testone'
}
}
},
and the js code where the items are fed to the data property of the datatable,
let items =[];
this._cached.forEach(item => {
item.testone = 'testone';
items.push(item);
});
the datatable is rendering correctly but the Quantity is always editable when it shouldn't. Any idea where I am going wrong?
I can see the css being applied, see the screenshot below. [![chrome inspector screenshot][1]] [1]: https://i.sstatic.net/sQmw8.png
editable : true
. Does the space betweeneditable
and:
matter? Elsewhere you haveattribute:
(no space before the colon).editable: true
andeditable: 'true'
. Possibly they are used in different contexts, as I didn't read the fine print. Did you try it with the single quotes? [1] developer.salesforce.com/docs/component-library/bundle/…