ngtreegrid
ngtreegrid copied to clipboard
Add data at run time.
Trying to configure data at run time but data is not displaying. at starting data is blank.
`hoursData: any[] = [];
configs: any = {
'group_by': 'type',
'group_by_header': 'Product Type',
'group_by_width': '100px',
'columns': [{
'header': 'Product Name',
'name': 'name',
'sortable': false
}, {
'header': 'Price',
'name': 'price',
'width': '200px',
'group_aggregator': (array) => {
const prices = array.map((item) => item.price);
return '$' + prices.reduce((acc, item) => acc + item);
}
}]
};
var i = 1;
for (const value of iPlanned) {
let restallx = { type: 'Planned', name: value.Month, price: value.Hours };
i++;
this.hoursData.push(restallx);
}
i = 1;
for (const value of iEstimated) {
let restallx = { type: 'Estimated', name: value.Month, price: value.Hours };
i++;
this.hoursData.push(restallx);
}
i = 1;
for (const value of iActual) {
let restallx = { type: 'Actual', name: value.Month, price: value.Hours };
i++;
this.hoursData.push(restallx);
}
this.angularGrid.store.setRawData(this.hoursData);
this.angularGrid.store.processData(null, null, null, null);
this.angularGrid.store.refreshDisplayData();
this.angularGrid.expandAll();`
Data is available in array however not displayed. Console displayed 'ngtreegrid.js:327 Data should not be empty!'
Can you tell us how to refresh data.
Have you tried this.hoursData = updatedData
?
I did, I even tried this.angularGrid.data = updatedData;
but no result. This should replace previous data with new data but not did the work