Just need some help to dynamically update a datatable column to make it editable. In my column definitions - I need to make a stock level column editable based on the results of my @wire call. Stock level is the 5th column.
columns= [
…
{
label: "Stock Level",
fieldName: 'stockLevel',
type: 'text',
editable: false
},
..]
In my @wire where I get the data, I process and check if the stock is editable (just need to check the first orderline for isStockLevelEditable as it would be same for each orderline) - sample code:
@wire(getOrderlines, {
orderId: '$orderId'
}) processOrderline({ error, data }) {
if (data) {
this.orderlines = data;
//Check if ordersline stock level is editable
if(this.orderlines.length != 0){
if(this.orderlines[0].isStockLevelEditable){
this.columns[5].editable = true;
console.log('updated columns ' + JSON.stringify(this.columns));
}
}
}
In the console log I successful see that the column is now editable (editable:true) - however in screen it is still not editable. What am I missing? Any help would be much appreciated