I am using the Gantt chart with Angular 7. I want a custom value in one of my configuration columns, but I can’t access external variables other than the obj
var. I tried following the example here https://docs.dhtmlx.com/gantt/api__gantt_columns_config.html
However, I want to be able to retrieve other variables other than obj
, but the scope of the function does not let me access other variables such as myVar
which is defined globally.
gantt.config.columns = [
{name:"text", label:"Task name", tree:true, width:'*' },
{name:"start_date", label:"Start time", align: "center" },
{name:"staff", label:"Holder(s)", template: function(obj){
return obj.holder+myVar} }
];
I also tried creating a new function that I can call in the template.
myFunction(obj) {
return obj.text + myVar;
}
gantt.config.columns = [
{name:"text", label:"Task name", tree:true, width:'*' },
{name:"start_date", label:"Start time", align: "center" },
{name:"staff", label:"Holder(s)", template: myFunction(obj) }
];
But in the above example, obj
cannot be found.
Any ideas? Thank you!