I am trying to add columns to Gantt dynamically. I cannot manage to use a field when it nested values.
In the current scenario, I have a metas property on my model, but struggling to reach nested keys as the field name.
Am I missing something? Or do I need to loop over my data and carry rate and currency on one upper level? The keys under metas are populated by the user, so I cannot add it manually on the config file.
"metas": {
"rate": {
"id": 32,
"value": 5
},
"currency": {
"id": 1234,
"value": "gbp"
}
},
let meta = { field : 'metas.rate', text: 'Rate', renderer({ item }) {
if( item ){
return `${item.value}`
}
return 0
} };
ganttConfig.columns.splice(ganttConfig.columns.length-1,0,meta);
class MyTaskModel extends TaskModel {
static get fields() {
return [
{ field: 'rate', type : 'number' }
];
}
}