I have the following code:
setDataTG : function(component){
var data = [], tgdata = [], current, row, picklistMAP = component.get("v.picklistMAP"), dataComplex = component.get("v.dataComplex");
dataComplex.forEach(function(d){
row = {};
//Parse data
if(d.hasOwnProperty('neOrderItem')){
current = d.neOrderItem;
Object.keys(current).forEach(function(k){
if(k === 'NE__ProdName__c'){
row['NE__ProdName__c'] = current['Name'] + ' - ' + current['NE__ProdName__c'];
}
else if(k === 'NE__Status__c'){
row['NE__Status__c'] = picklistMAP[current['NE__Status__c']];
}
else{
row[k] = current[k];
}
});
}
//Check children
if(d.hasOwnProperty('children')){
data["_children"] = this.setDataTGChildrenHelper(component, d.children);
}
data.push(row)
tgdata.push(row);
});
console.log('****complex: ' + JSON.stringify(data));
component.set("v.data", data);
component.set("v.tgdata", tgdata);
component.set("v.isLoading", false);
},
And it's not letting me call setDataTGChildrenHelper giving me the following error:
[Cannot read property 'setDataTGChildrenHelper' of undefined]
How can I fix this?